You have been asked to write a simple question and answer programme. There is only one question to answer: "What is the capital of France".
The programme should ask the user this question, then prompt for a response.
The user then types in an answer.
If the answer is correct, the programme should tell the user that their answer was correct.
If the answer is incorrect, the programme should tell the user that their answer was wrong.
#include <iostream>
#include <string>
using namespace std;
int main(){
cout<<"What is the capital of France?\n";
string answer;
cin>>answer;
if(answer == "Paris") cout<<"Your answer is right";
else cout<<"Your answer is wrong";
return 0;
}
Comments
Leave a comment