fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int choice; // to hold an integer representing the user's choice
  7.  
  8. cout << "------- Menu -------\n"
  9. << " 1: Charles Dickens\n"
  10. << " 2: Dr. Seuss\n"
  11. << " 3: Albert Einstein\n"
  12. << " 4: Anna of Arendell\n"
  13. << "--------------------\n"
  14. << "\n";
  15. cout << "Enter the number of the person to display a quote from"
  16. << " (1, 2, 3, or 4): ";
  17. cin >> choice;
  18.  
  19. cout << "\n";
  20.  
  21. cout << "-----------------------------------------"
  22. << "--------------------------------------\n";
  23.  
  24. if (choice == 1) {
  25. cout << "It was the best of times,\n"
  26. << "it was the worst of times,\n"
  27. << "it was the age of wisdom,\n"
  28. << "it was the age of foolishness,\n"
  29. << "it was the epoch of belief,\n"
  30. << "it was the epoch of incredulity,\n"
  31. << "...\n"
  32. << " -- Charles Dickens, \"A Tale of Two Cities\"\n";
  33. }
  34. else if (choice == 2) {
  35. cout << "You have brains in your head.\n"
  36. << "You have feet in your shoes.\n"
  37. << "You can steer yourself in any direction you choose.\n"
  38. << "You're on your own, and you know what you know.\n"
  39. << "And you are the guy who'll decide where to go.\n"
  40. << " -- Dr. Seuss, \"Oh, the Places You'll Go!\"\n";
  41. }
  42. else if (choice == 3) {
  43. cout << "A person who never made a mistake never tried anything new.\n"
  44. << " -- Albert Einstein\n";
  45. }
  46. else if (choice == 4) {
  47. cout << "Do you wanna build a ☃ ?\n"
  48. << " -- Anna of Arendell, \"Frozen\"\n";
  49. }
  50. else {
  51. cout << "That is not a valid option!\n";
  52. }
  53.  
  54. cout << "-----------------------------------------"
  55. << "--------------------------------------\n"
  56. << "\n";
  57.  
  58. return 0; // success
  59. }
Success #stdin #stdout 0s 3344KB
stdin
3
stdout
------- Menu -------
 1: Charles Dickens
 2: Dr. Seuss
 3: Albert Einstein
 4: Anna of Arendell
--------------------

Enter the number of the person to display a quote from (1, 2, 3, or 4): 
-------------------------------------------------------------------------------
A person who never made a mistake never tried anything new.
 -- Albert Einstein
-------------------------------------------------------------------------------