fsfsa
New Coder
Hi, I'm trying to do a game over screen for a survival game I'm creating in my high school intro to programming class, but I can't seem to get the loop to end.Once it says game over it moves on to the next section. I also want to add an option to play again. Here is a part of my project as an examaple. I'm still new to coding so I'm not sure how to do this-please help.
C++:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <stdlib.h>
#include <windows.h>
#include<conio.h>
#include<dos.h>
using namespace std;
void SetWindow (int Width, int Height);
int GetFontSize(HANDLE windowHandle, COORD *size);
int SetFontSize (HANDLE windowHandle, COORD size);
void gameOverscreen();
char charName;
char lastName;
int main()
{
if (color == "Red" || color == "red")
{
cout << "Good choice. These are tasty and safe" << endl;
}
else if (color == "purple" ||color == "Purple")
{
cout << "oh no, These were poisonous. YOU'RE DEAD";
gameOverscreen();
cout << "*****Game Over*****\n";
}
else if (color == "Black" || color == "black")
{
cout << "Good choice. These are exotic and safe" << endl;
}
cout << " The dome is loaded with more supplies " << endl;
cout << "Would you like to use your map to find the dome? "<< endl;
return 0;
}
void gameOverscreen()
{
cout << "*****Game Over*****\n";
}