I don't know what your program is supposed to do because you did not tell us.
Anyway, a bit of general advice... With a relatively simple program like this it does not matter much but as you begin to write bigger more sophisticated programs, it will help you if you make more meaningful choices of variable names. Name1 and Name2 are bad choices. For example rather than using DrinkP to represent the price of a drink and Name1 to represent the name of a drink use something like DrinkPrice and DrinkName (and also FoodPrice and FoodName). The names should make it readily apparent to someone looking at the program what they are about. Even if no one other than yourself looks at the program, well chosen variable names will help you if you need to work on a program that you haven't looked at for a year. [email protected] wrote: > > > > //Torrestest1.cpp > //the club > > #include <iostream> > #include <string> > > I am a current student at Keiser , I am trying to run this program put > the calculation is not doing what it is suppose to do. Is there anybody > who knows where and what i did wrong. It will really help. > Thank you in advance for your help. > > using std::cout; > using std::cin; > using std::endl; > using std::string; > > int main () > > { > > //Declaring Variable > string Name1 = ""; > string Name2 = ""; > int DrinkP = 0; > int FoodP = 0; > int TDp = 0; > > //Enter input Items > cout << "What type of Drinks are you intrested in... "; > getline(cin, Name1); > cout << "Enter Price... "; > cin >> DrinkP; > > cout << " Please Enter the Name of the Food... "; > getline(cin, Name2); > cout << "Please Enter Price ... "; > cin >> FoodP; > > //Calculation > TDp = DrinkP + FoodP; > > > //Display output > cout << "The Cost For Food is:: " << FoodP << endl; > cout << "The Cost For Drink is:: " << DrinkP << endl; > > return 0; > } > > > >
