Ok heres what I have, I moddified the code to do what i wanted it to do, but at the end result (the correct answer) where it is supposed to say "yay you got the right answer" Im getting nothing but program terminating and the window closing... Is there a way to stop this?
Here is what I have so far...
Code:
#include <iostream>
using namespace std;
int main(){
int answer;
cout<<"what is 4+4: ";
cin>>answer;
while(answer!=8)
{
cout<<"no that's wrong, try again:\n ";
cout<<"What is 4+4:"; cin>>answer;
}
cout<<"yay you got the right answer\n";
cout<<"Congratulations! Please press enter";
cin.get();return 1;
}
EDIT: Nevermind I figured it out :
Code:
#include <iostream>
using namespace std;
int main(){
int answer;
cout<<"what is 4+4: ";
cin>>answer;
while(answer!=8)
{
cout<<"no that's wrong, try again:\n ";
cout<<"What is 4+4:"; cin>>answer;
}
cout<<"yay you got the right answer\n";
cout<<"Congratulations! Please press enter";cin>>answer;
cin.get();return 1;