Answer to Question #242954 in C++ for Urooj

Question #242954

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.


1
Expert's answer
2021-09-28T00:49:46-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS