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.  
  14. cout << "Answer the following questions";
  15. cout << endl;
  16. cout << "What is the national bird of India?" ;
  17. cout << endl;
  18. cin >> ans ;
  19. if (ans == "Peacock")
  20. { x = x+1;
  21. cout << "Correct! You have scored one point";
  22. }
  23. else
  24. x = 0;
  25. cout << "Wrong answer!";
  26. cout << endl;
  27.  
  28.  
  29. cout << "Who is the Prime Minister of India?";
  30. cout << endl;
  31. cin >> ans;
  32. if (ans == "Modi")
  33. { x = x+1;
  34. cout << "Correct! You have scored one point" << endl; }
  35. else {
  36. x = x;
  37. cout << "Wrong answer";
  38. cout << endl;
  39. }
  40.  
  41. cout << "Name the capital of Punjab";
  42. cout << endl;
  43. cin >> ans;
  44. if ( ans == "Chandigarh")
  45. {x = x+ 1;
  46. cout << "Correct! you have scored one point!!" << endl;
  47. }
  48. else
  49. {
  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 15240KB
stdin
Peacoco
Modi
Chandigarh
stdout
Answer the following questions
What is the national bird of India?
Wrong answer!
Who is the Prime Minister of India?
Correct! You have scored one point
Name the capital of Punjab
Correct! you have scored one point!!
Your total score is 2