fork download
  1. /* Answer the following three questions. Each question is awarded one point
  2. 1. what is the national bird of India?
  3. 2.Who is the Prime Minister of India?
  4. 3. Name the capital of Punjab */
  5.  
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int x=0;
  12. string ans;;
  13. string ans1;
  14. string ans2;
  15.  
  16. cout << "Answer the following questions";
  17. cout << endl;
  18. cout << "What is the national bird of India?" ;
  19. cout << endl;
  20. cin >> ans ;
  21. if (ans == "Peacock")
  22. { x = x+1;
  23. cout << "Correct! You have scored one point";
  24. }
  25. else
  26. x = 0;
  27. cout << "Wrong answer!";
  28. cout << endl;
  29.  
  30.  
  31. cout << "Who is the Prime Minister of India?";
  32. cout << endl;
  33. cin >> ans1;
  34. if (ans1 == "Modi")
  35. { x = x+1;
  36. cout << "Correct! You have scored one point"; }
  37. else
  38. x = x;
  39. cout << "Wrong answer";
  40. cout << endl;
  41.  
  42. cout << "Name the capital of Punjab";
  43. cout << endl;
  44. cin >> ans2;
  45. if ( ans2 == "Chandigarh")
  46. {x = x+ 1;
  47. cout << "Correct! you have scored one point!!";
  48. }
  49. else
  50. x = x;
  51. cout << "Wrong answer!";
  52. cout << endl ;
  53.  
  54. cout << "Your total score is" << x;
  55.  
  56. return 0;
  57. }
Success #stdin #stdout 0s 16064KB
stdin
Peacock
Modi
asfjh
stdout
Answer the following questions
What is the national bird of India?
Correct! You have scored one pointWrong answer!
Who is the Prime Minister of India?
Correct! You have scored one pointWrong answer
Name the capital of Punjab
Wrong answer!
Your total score is2