Ok, I have made adjustments to this and I am still getting all sorts of errors....like "item" is an undeclared identifier. and size is undeclared identifier..that kidn of thing...so what the HECK am I doing wrong!?!?!?!!
#include <algorithm>
#include <iostream>
#include <string>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::fixed;
int main()
{
//declare variables
char Lemonade='l';
int lg_ade= 'lg';
char sm_ade ='s';
char Cookie ='c';
int c_cookie ='cc';
char o_cookie ='o';
char tshirt ='t';
char a_tshirt ='a';
char n_tshirt ='n';
int tot_trans = 0;
double tot_oz = 0.0;
int tot_c_cookie=0;
int tot_o_cookie= 0;
int tot_a_tshirt=0;
int tot_n_tshirt=0;
double tot_sales = 0.0;
double bid =0.0;
double highest_bid=0.0;
char sentinel ='q';
char item;
char choice;
char size;
char type;
//get user's input
cout << "Welcome To Your Lemonade Stand! \n\n";
cout << "Ok, Today's selections consist of Cookies, Chocolate Chip or Oatmeal. \n\n""Two sizes of Lemonade, Large which is 16 oz and Small \n\n""which is 12 oz. And special for today, we have two t-shirts! \n\n""One is autographed by the This Old House crew and the other is plain.\n\n";
cout<< "\n\nPlease enter a L for lemonade\n\n""Please enter C for cookie\n\n""Please enter T for tshirt\n\n""if you wish to quit this program, please press the 'Q' on your keyboard. \n\n";
while item!='q'&&
item!='l'&&
item!='c'&&
item!='t'
getline(cin, item);
transform(item.begin(), item.end(), item.begin(),toupper);
cout<<"Invalid Entry. Please try again.\n\n";
{
cout<<"If you would like to purchase Lemonade, enter a L to select. \n\n""If you would like to purchase a Cookie, please enter a C to select. \n\n""If you would like to purchase a T-shirt, please enter a T to select. \n\n";
cin>> item;
item=toupper(item);
if (item==l)
{
cout<<"Enter S for a small lemonade.\n\n"
cin>> size;
cout<<fixed;setrprecision(2);
cout << "Your total is $1.50 \n\n";
cin>> tot_oz+=1;
cin>> tot_sales+=1.50;
}
elseif (size==lg)
{
cout<< "Your total is $2.00. \n\n";
cin>> tot_oz+=16;
cin>> tot_sales+=2.00;
}
elseif (item==C)
{
cout<<"Enter O for an Oatmeal cookie or CC for a chocolate chip cookie.\n\n";
cin>> type;
cout<<fixed;setrprecision(2);
cout << "Your total is $0.75 \n\n";
cin>> tot_o_cookie+=1;
cin>> tot_sales+=.75;
}
elseif (size==CC)
{
cout<< "Your total is $0.75. \n\n";
cin>> tot_c_cookie+=1;
cin>> tot_sales+=.75;
}
elseif (item==T)
{
cout<<"Enter A for an Autographed T-Shirt.\n\n";
cin>> type;
cout<<fixed;setrprecision(2);
cout << "Your total is $15.00 \n\n";
cin>> tot_a_tshirt+=1;
cin>> tot_sales+=15.00;
}
else (size==N)
{
cout<< "Your total is $8.00. \n\n";
cin>> tot_n_tshirt+=1;
cin>> tot_sales+=8.00;
} end while
//display menu again Of course this is incomplete!
return(0);
}
It has got a ')' it's about four lines down (from while).
It looks like it is missing { and } arould the block of code you are trying to put in the while loop, as a result it will only loop the getline(cin, item);
I have only give this a cursory glance, but there dose seem to be quite allot wrong.
To start with you need for format your code and/or make sure it stays formatted when posting.
At a glance, I could say that your item is declared as string and compared as a single char and in all if conditional checks the quotes around string literals are missing.
First, change this:
while (item!='Q'&& item!='L'&& item!='C'&& item!='T')
to:
while (item!="Q" && item!="L"&& item!="C" && item!="T")
and change all if conditional literal checks with enclosed quotes like:
if (item=="L")
else if (item=="lg")
else if (item=="C")
else if (item=="CC")
Try it out with recompiling the code and check it out. If it still fails, you better check line by line with other compiler errors.
cout << "Ok, Today's selections consist of Cookies, Chocolate Chip or Oatmeal. \n\n"
<<"Two sizes of Lemonade, Large which is 16 oz and Small \n\n"<<
"which is 12 oz. And special for today, we have two t-shirts! \n\n"<<
"One is autographed by the This Old House crew and the other is plain.\n\n";
extraction operator sud be inserted more than once...i e cascading.....