#Include Using Namespace Void Int Int Int

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

#include<iostream>

using namespace std;


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;

cout<<"you seleced a coffee cake ";


price=2500;
break;
default:
cout<<"invalid entry";
}
cout<<price;
}

You might also like