// @topic W05-0-030 Ping-pong example
// @brief C/C++ implementation file for ping() and pong()
#include "ping_pong.h"
// global variables:
int shot_count = Default_Shot_Count;
int max_shots = Default_Max_Shots;
void ping()
{
if ( shot_count > max_shots ) return;
++shot_count; // count each shot
std::cout << " ping! ";
pong();
}
void pong()
{
if ( shot_count > max_shots ) return;
++shot_count; // count each shot
std::cout << " pong! ";
ping();
}