The code defines a function called rangebased that takes an integer as a parameter. It then prompts the user to enter a number range, calls the rangebased function and passes the input value. The rangebased function displays different cake options based on the number range entered and uses a switch statement to set a price based on the user's cake selection.
The code defines a function called rangebased that takes an integer as a parameter. It then prompts the user to enter a number range, calls the rangebased function and passes the input value. The rangebased function displays different cake options based on the number range entered and uses a switch statement to set a price based on the user's cake selection.
The code defines a function called rangebased that takes an integer as a parameter. It then prompts the user to enter a number range, calls the rangebased function and passes the input value. The rangebased function displays different cake options based on the number range entered and uses a switch statement to set a price based on the user's cake selection.
The code defines a function called rangebased that takes an integer as a parameter. It then prompts the user to enter a number range, calls the rangebased function and passes the input value. The rangebased function displays different cake options based on the number range entered and uses a switch statement to set a price based on the user's cake selection.
void rangebased (int ); int main () { int range ; cout<<"enter your range"<<endl; cin>>range; rangebased(range); system ("pause"); return 0; } void rangebased (int x ) { int selection,price; if (x=500) { cout<<"you can buy a fruit cake "; cout<<"press 0 for selection"; cin>>selection; } if (x=1000&&x<1500) { cout<<"you can buy a fruit cake or you can buy a chocolate cake "; cout<<"press 0 for selection of fruit cake and 1 for chocolate"; cin>>selection; } if (x=1500&&x<2000) { cout<<"you can buy a fruit cake or you can buy a chocolate cake or a cheese cake "; cout<<"press 0 for selection of fruit cake and 1 for chocolate and 2 for cheese"; cin>>selection; } if (x=2000&&x<2500) { cout<<"you can buy a fruit cake or you can buy a chocolate cake or a cheese cake or a mousee"; cout<<"press 0 for selection of fruit cake and 1 for chocolate and 2 for cheese or 3 for mousee"; cin>>selection; } if (x>=2500) { cout<<"you can buy a fruit cake or you can buy a chocolate cake or a cheese cake or a mousee or a coffee cake"; cout<<"press 0 for selection of fruit cake and 1 for chocolate and 2 for cheese or 3 for mousee or 4 for cofee cake "; cin>>selection; } switch (selection) { case 0: cout<<"u selected fruite cake"; price=500; break; case 1: cout<<"you selected chocolate cake "
break; case 2:
case 3:
case 4:
price=1000;
cout<<"you selected a cheese cake ";
price=1500; break; cout<<"you selected a mousee cake "; price=2000; break;