When i Execute my program everything seem to run perfect. but when i type N to exit the program. it continues playing... if you need the full code tell me i can paste if... its kinda long..
P.S i'm doing this program just to practice my C++ skills before school starts
while(game = true)
{
//Genrating a number to bring up a question.
option = rand() % 4 + 1;
if(option == 1)
{
Add(answ);
system("cls");
}
elseif(option == 2)
{
Sub(answ);
system("cls");
}
elseif (option == 3)
{
Quot(answ);
system("cls");
}
elseif (option == 4)
{
Mult(answ);
system("cls");
}
else
{
cout << "Error in the program.. will be fixed. Sorry" << endl << endl;
return -1;
}
//Saving or Risking
if(point >= 10)
{
cout << "You gained 100 points! Would you like to continue? <Y/N>" << endl;
cin >> cont;
if(cont == 'Y' || 'y')
{
cout << "Alright, up to you.. Good luck." << endl;
system("pause");
system("cls");
}
elseif(cont == 'N' || 'n')
{
cout << "Alright, your highest score was " << point << " it will be saved for the next round" << endl << endl;
system("pause");
game = false; // DOES NOT EXIT THE GAME WHEN PROMOT! NEED FIX
}
else
{
cout << "What are yout trying to break the code? let me tell you right now this is not the way :)" << endl;
system("pause");
system ("cls");
}
//Making sure points are not negative or less than -10
if(point <= -1)
{
cout << "You have points, you better get the next question correct if you want to keep playing." << endl;
}
elseif(point <= -10)
{
cout << "You reached a limit :( " << point << " We cant save that as your score." << endl;
game = false;
}
}
}