Hi I am new to C++ and programming in general, Ok so when I run my project and come to the question would you like a quiz? I can not answer it I don't know why but I can write/answer for Hello, How are you today? so I am really stuck here is the code:
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string input;
int i;
std::cout << "Hello, how are you today?\n";
cin >> i;
std::cout << "would you like a quiz?\n";
cin >> i;
system("pause");
return 0;
}
Line 12: Are you really expecting someone to answer with a number?
Line 13: You're doing a cin to an int. If the user doesn't type a number, the cin (line 12) will fail and the data the user typed will still be in the input buffer.