Write a C++ program which takes the price of bakery items ranging from 0-999

Write a C++ program for purchased bakery items and to find their average

Object:

Write a C++ program which takes the price of bakery items ranging from 0-999

• if you enter PKR 1-200 it should show cakes
• if PKR 200 – 400 SHOW BISCUITS
• if PKR 400- 700 show miscellaneous
• if PKR 700 – 999 show ice cream your program to should run 3 times using While loop in the end also take the average of all items price. C++ Projects.

Code:

#include<iostream>
#include<conio.h>

using namespace std;
void main()
{
int price, bisc, cake, icr, misc;
float sum=0, avg, purch=1;
while(purch<=3)
{
cout<<“\nPlease Enter the price Bakery items: “;
cin>>price;
//condition
if(price > 0 && price < 999)
{
sum=price+sum;
avg=sum/purch;
if(price >= 1 && price < 200)
{
cin>>cake;
cout<<“\nYou Ordered for “<<cake<<” Cake.”<<endl;
}
else if(price >=200 && price < 400)
{
cin>>bisc;
cout<<“\nYou Ordered for “<<bisc<<” Biscuits.”<<endl;
}
else if(price >=400 && price < 700)
{
cin>>misc;
cout<<“\nYou Ordered for “<<misc<<” Miscellaneous.”<<endl;
}
else if(price >=700 && price < 999)
{
cin>>icr;
cout<<“\nYou Ordered for “<<icr<<” Ice Cream.”<<endl;
}
}
purch++;
}
cout<<“\nThe Average of all items Price is: “<<avg<<endl;
getch();
}

```#include<iostream>
#include<conio.h>

using namespace std;
void main()
{
int price, bisc, cake, icr, misc;
float sum=0, avg, purch=1;
while(purch<=3)
{
cout<<"\nPlease Enter the price Bakery items: ";
cin>>price;
//condition
if(price > 0 && price < 999)
{
sum=price+sum;
avg=sum/purch;
if(price >= 1 && price < 200)
{
cin>>cake;
cout<<"\nYou Ordered for "<<cake<<" Cake."<<endl;
}
else if(price >=200 && price < 400)
{
cin>>bisc;
cout<<"\nYou Ordered for "<<bisc<<" Biscuits."<<endl;
}
else if(price >=400 && price < 700)
{
cin>>misc;
cout<<"\nYou Ordered for "<<misc<<" Miscellaneous."<<endl;
}
else if(price >=700 && price < 999)
{
cin>>icr;
cout<<"\nYou Ordered for "<<icr<<" Ice Cream."<<endl;
}
}
purch++;
}
cout<<"\nThe Average of all items Price is: "<<avg<<endl;
getch();
}
```

Output:

Another Program: Write a C++ Program to print the bill.

4 thoughts on “Write a C++ program which takes the price of bakery items ranging from 0-999”

1. Greetings! This is my 1st comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading your blog posts. Can you recommend any other blogs/websites/forums that cover the same subjects? Thanks!

2. When someone writes an article he/she retains the image of a user in his/her