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" << endl; }
  37. else {
  38. x = x;
  39. cout << "Wrong answer";
  40. cout << endl;
  41. }
  42.  
  43. cout << "Name the capital of Punjab";
  44. cout << endl;
  45. cin >> ans2;
  46. if ( ans2 == "Chandigarh")
  47. {x = x+ 1;
  48. cout << "Correct! you have scored one point!!" << endl;
  49. }
  50. else
  51. {
  52. x = x;
  53. cout << "Wrong answer!";
  54. cout << endl ;
  55. }
  56. cout << "Your total score is" <<" " << x;
  57.  
  58. return 0;
  59. }
Success #stdin #stdout 0s 15240KB
stdin
Peacfefe
Modi
Dhad
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
Wrong answer!
Your total score is 1