Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ programining exercise 2. Do Chapter 10\'s Programming Exercise 8, using the

ID: 3777780 • Letter: C

Question

C++ programining exercise

2. Do Chapter 10's Programming Exercise 8, using the name Lab12ClockType Enhanced. (Your files will build upon the files that you created for the previous program.) Your program should consist of three files: clockTypeEnhanced h, a header file that declares your class. clockTypeEnhanced.cpp, an implementation file that defines your class's member functions. Lab12ClockTypeEnhanced.cpp, a file that tests your class by creating a clockTypeEnhanced object and demonstrating the member functions. Show me your working program

Explanation / Answer

#include #include void run(); void printMap(); void initMap(); void move(int dx, int dy); void update(); void changeDirection(char key); void clearScreen(); void generateFood(); char getMapValue(int value); // Map dimensions const int mapwidth = 20; const int mapheight = 20; const int size = mapwidth * mapheight; // The tile values for the map int map[size]; // Snake head details int headxpos; int headypos; int direction; // Amount of food the snake has (How long the body is) int food = 3; // Determine if game is running bool running; int main() { run(); return 0; } // Main game function void run() { // Initialize the map initMap(); running = true; while (running) { // If a key is pressed if (kbhit()) { // Change to direction determined by key pressed changeDirection(getch()); } // Upate the map update(); // Clear the screen clearScreen(); // Print the map printMap(); // wait 0.5 seconds _sleep(500); } // Print out game over text std::cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote