guys this is my project and i need your guidance based on c++ because i don't have basics in c++...i have no idea how to continue program this codes...anyone can help me?
#include <iostream> // library that contains basic input output functions
#include <cmath>
using namespace std;
int main()
{
int option; // user's entered option will be saved in this variable
do //do-while loop starts here.that display menu again and again until user select to exit program
{
//Displaying Options for the menu
cout << "1) cakes " << endl;
cout << "2) Pastry " << endl;
cout << "3) Drinks" << endl;
cout << "4) Exit Program " << endl;
//Prompting user to enter an option according to menu
cout << "Please choose your favourite items : ";
cin >> option; // taking option value as input and saving in variable "option"
if(option == 1) // Checking if user selected option 1
{
//Display cakes
I would want to use separate variables to keep track of the user's selection from the main menu, which drives the while loop, and the selections from individual product menus.
I think I would also try to be consistent in using either a number or an alpha character for the product menus. Right now the cakes use letters while the pastries and coffees use numbers.
So after user cin>>option you may ask the user something like cout << "What would you like to buy?" << endl;. Get the user input and calculate the total.
If you need anymore help, pm me for a faster response.
int num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,num7=0,num8=0,num9=0,num10=0;
int num_customers;
int sentinel=0;
const double unitprice1= 20.00,unitprice2= 25.00,unitprice3= 30.00,unitprice4= 35.00,unitprice5=35.00,unitprice6= 40.00,unitprice7=55.00,unitprice8=60.00,unitprice9= 100.00,unitprice10= 120.00;
float AmountofSale1= 0, AmountofSale2=0, AmountofSale3=0,AmountofSale4=0,AmountofSale5=0,AmountofSale6=0,AmountofSale7=0,AmountofSale8=0,AmountofSale9=0,AmountofSales9=0,AmountofSales10=0;
string name,addr;
int phone_num;
float addition;
{
cout<<"\t\t********************************"<<endl;
cout<<"\t\t WELCOME TO DAISY BAKERY SHOP"<<endl;
cout<<"\t\t********************************\n"<<endl;
}
{
cout<<"PLEASE ENTER YOUR NAME:"<<endl;
cin>>name;
cout<<"\tWELCOME TO DAISY BAKERY SHOP:"<<name<<endl;
cout<<"*******************************"<<endl;
cout<<"PLEASE ENTER YOUR PHONE NUMBER"<<endl;
cin>>phone_num;
cout<<"THANK YOU FOR YOUR INFORMATION"<<endl;
}
cout<<"*******THE WORLD OF SWEETS***************\n\n" << endl;
It would be good practice to use [code]Your code here[./code](without the period) so it's not just a long line of text. Your code right now asks the user to calculate the total cost, is that intended, or is your program suppose to do that? If your program is suppose to calculate the total, then you should have a float sum and increase sum after every purchase.