fork download
  1. //PeanutButterJelly.cpp This program willask the user if he/she preffersPeanut butter or Jelly.
  2. /*Arturo Madero
  3. April 2, 2020
  4. 10-4
  5. Done by myself*/
  6.  
  7. #include <iostream>
  8. using namespace std;
  9. int main() {
  10.  
  11. //Title
  12. cout<<"\t\tPeanut Butter or Jelly?"<<endl<<endl;
  13.  
  14. //declare variables
  15. char desition, desition2;
  16.  
  17. //input
  18. cout<<"Do you prefer Peanut butter (P) or Jelly (J)?";
  19. cin>>desition;
  20. desition = toupper (desition);
  21.  
  22. //output
  23. if (desition == 'P')
  24. {
  25. cout<<"Do you rather crunchy (C) or creamy (Y)?"<<endl;
  26. cin>>desition2;
  27. desition2 = toupper (desition2);
  28. cout<<endl;
  29. if (desition2 == 'C')
  30. {
  31. cout<<"You like crunchy peanut butter"<<endl;
  32. }
  33. else if (desition2 == 'Y')
  34. {
  35. cout<<"You like creamy peanut butter"<<endl;
  36. }
  37. else
  38. {
  39. cout<<"Not a good choice."<<endl;
  40. }
  41. }
  42. else if (desition == 'J')
  43. {
  44. cout<<"Dou you rather grape (G) or strawberry (s)?";
  45. cin>>desition2;
  46. desition2 = toupper (desition2);
  47. cout<<endl;
  48. if (desition2 == 'G')
  49. {
  50. cout<<"You like grape jelly."<<endl;
  51. }
  52. else if (desition2 == 'S')
  53. {
  54. cout<<"You like strawberry jelly."<<endl;
  55. }
  56. else
  57. {
  58. cout<<"Wrong answer."<<endl;
  59. }
  60. }
  61. else
  62. {
  63. cout<<"Wrong answer."<<endl;
  64. }
  65. return 0;
  66. }
Success #stdin #stdout 0s 4264KB
stdin
Standard input is empty
stdout
		Peanut Butter or Jelly?

Do you prefer Peanut butter (P) or Jelly (J)?Wrong answer.