Question: Assume the following code: string jollyR; int appleCnt =0, raspCnt = 0, grapeCnt = 0; cout < < Favorite Jolly Rancher Flavor: G for Green

Assume the following code:

string jollyR;

int appleCnt =0, raspCnt = 0, grapeCnt = 0;

cout << “Favorite Jolly Rancher Flavor: G for Green Apple, R for Raspberry?”;

cin >> jollyR;

Write a cascading decision statement to test the value contained in jollyR. If the value in jollyR

  • Is equal to “G”, add 1 to the appleCnt variable
  • Is equal to “R”, add 1 to the raspCnt variable
  • Is equal to anything else, add 1 to the grapeCnt variable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres an example of a cascading decision statement in C that tests the v... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!