#include using namespace std; #include #include #include void main() { srand(unsigned int(time(NULL))); const int nLimitX = 25; // a constant to represent the X-boundary of the game environment -- valid range 0-24 (inclusive) const int nLimitY = 15; // a constant to represent the Y-boundary of the game environment -- valid range 0-14 (inclusive) int nPlayerX = rand()%nLimitX; int nPlayerY = rand()%nLimitY; // 1: Loop to display the current time, but each iteration of the loop is time_t ttStartTime = time(NULL); unsigned char ucDirection; do { system("cls"); // clear the screen before redisplaying the location information and map // DISPLAY STATUS INFORMATION cout << "Your location is " << nPlayerX << ", " << nPlayerY << endl; cout << "You have played for " << (time(NULL) - ttStartTime) << " seconds" << endl; // end DISPLAY STATUS INFORMATION // DISPLAY A VISUAL MAP for (int nY=0; nY