Need a little help here on the frist part of this program. I have no finished the rest of code but i am trying to test out and run what i have so far. but i keep getting this error from the last brace of the code: syntax error : '}'
. then when i remove that brace i get this error: fatal error C1075: end of file found before the left brace '{'
. any help on this will be great thank you.
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
std::string word[5];
int main ()
{
//Declaring Variables
ifstream inFile;
char choice;
int secret_number;
int user_number;
// opening files
inFile.open("secret number.txt");
//menu
do{
cout << "A: To Play the number guessing game." << endl;
cout << "B: To Play the letter game." << endl;
cout << "C: To quit program." << endl;
cin >> choice;
while (choice != 'c' && choice != 'C');
switch (choice)
{
case 'A':
case 'a':
cout << "Welcome to the Guess the Number Game." << endl;
cout << "\n I am thinking of a number between 1 and 100." << endl;
// Loops forever until user finds the number
while (user_number != secret_number)
{
cout<<"Pick a number : ";
cin >> user_number;
inFile >> secret_number;
if (secret_number > user_number)
cout << "Higher!"<<endl<<endl;
else if (secret_number < user_number)
cout << "Lower!"<<endl<<endl;
else
cout << "Good job! You found the number!"<<endl<<endl;
}
}
break;
}
}