Hey forum, I'm having a problem with my program. I can't seem to enter more than one command and then I'm forced to close my program. For example, when I assign a value to a variable and press enter it goes through, but then when I try to perform another action the window closes... any hot fixes?
include <iostream>
int main()
{
using std::cin;
using std::cout;
using std::endl;
cout << "\nWELCOME TO COUNTER STRIKE: CMD TASK FORCE!" << endl;
cout << "\n\nWhat would you like to do? Select one of the options below; \nenter the numberthat represents the option:\n===========================================================\n";
int goption;
cout
<< "1) Start Game..."
<< endl
<< "2) How to Play..."
<< endl
<< "3) About..."
<< endl
<< "4) Exit."
<< '\n';
cin >> goption;
cin.ignore();
if (goption == 1) {
cout << "You are equipped with armor and a weapon." // String continues...
"Your team has fallen and you're the only survivng member." // String continues...
"There are three enemys left, and how you fight will ultimately" // String continues...
"lead to whether you're victorious or your mission was a failure." // String continues...
"How do you want to proceed?"; // String ends.
} else { goption >= 5; }
if (goption == 2) {
cout << "Simply enter options as you make your way through the game.";
} else { goption >= 5; }
if (goption == 3) {
cout << "Counter Strike: CMD Task Force was written by Weston Soden.""The program is a simple game that asks for the users input""throughout the game, though it is not very complex, it is"" still very fun.";
} else { goption >= 5; }
if (goption == 4) {
cout << "Press the \"ENTER\" key to exit:"; }
if (goption <= 0) {
cout << "Please enter a valid option."; }
if (goption >= 5) {
cout << "Plese enter a valid option."; }
cin.get();
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
return (0);
}
Sorry about the title, was a dumb idea i got in my head.