Please help can correct the errors

#include <iostream>
#include <string>

using namespace std;
int main()
{
int optionvalue = 0; string option;
cout << "welcome to the simple text game!";
do
{
cout << "\n\nplease select one of the following options:" << endl;
cout << " 1: play \n";
cout << " 2: help \n";
cout << " 3: option \n";
cout << " 4: quit \n";
cin >> option; optionvalue = atoi( option.c_str() );
//atoi() converts a char * to an int. returns 0 if input is not an int.

if (optionvalue == 0)
cout << "error: you did not enter an integer value?! please try again!"<< endl;

else if( optionvalue < 1 || optionvalue > 4 )
cout << "error: invalid option selected! please select from 1,2,3 or 4" << endl;

else
{
switch (optionvalue)
{
case 1:
cout << "play option selected!" << endl << endl;
break;
case 2:
cout << "help option selected!" << endl << endl;
break;
case 3:
cout << "config option selected!" << endl << endl;
break;
case 4: cout << "quit option selected!" << endl << endl;
break;
}
}
} while( optionvalue < 1 || optionvalue > 4 );
return 0;
What the problem u make?
i have no idea why cant it runs.

it shows:
: fatal error C1075: end of file found before the left brace '{'. was matched
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
you need a } after the return 0;

You should really use the [code] tag and also when coding indent all your code so you can find these errors easily.
Last edited on
Topic archived. No new replies allowed.