Hey all, I am trying to write a simple program for doing basic inventory and sales for fruit....but when i try to debug or compile it, i get a long string of errors that i cant get rid of...here is my source code...
I believe i have posted the .cpp file..
Thanks in advance
insertCode:#include <iostream> #include <string> using namespace std; int pears = 200; int apples = 150; int peaches = 300; int tomatoes = 250; int corn = 400; int userChoice; int sellChoice; int purchaseChoice; int menu(void); int main() { cout << "Would you like to do purchase or sell fruit?" <<endl << "[1] Purchase Fruit" <<endl << "[2] Sell Fruit" <<endl; cin >> userChoice; (userChoice == 1) ;{ cout; << "What type of fruit do you want to purchase?" endl; << "[1] pears" endl; << "[2] apples" endl; << "[3] peaches" endl; << "[4] tomatoes" endl; << "[5] corn" endl; cin; >> purchaseChoice; } if(purchaseChoice == 1) { cout << "How many would you like to purchase?" endl; cin >> bought; if(bought < 5) { sells = .50 * bought; cout << "You bought" <<bought<< "pears for $" <<sells; pears=pears - bought; cout << "You now have" <<pears<<"pears" endl } else { sells = .40 * bought; cout << "You bought" <<bought<< "pears for $" <<sells; pears=pears - bought; cout << "You now have" <<pears<<"pears" endl } } if(purchaseChoice == 2) { cout << "How many would you like to purchase?" endl cin >> bought; if(bought) { sells = .25 * bought; cout << "You bought" <<bought<< "apples for $" <<sells; apples=apples - bought; cout << "You now have" <<apples<<"apples" endl } } if(purchaseChoice == 3) { cout << "How many would you like to purchase?" endl; cin >> bought; if(bought < 5) { sells = .50 * bought; cout << "You bought" <<bought<< "peaches for $" <<sells; peaches=peaches - bought; cout << "You now have" <<peaches<<"peaches" endl; } else { sells = .30 * bought; cout << "You bought" <<bought<< "peaches for $" <<sells; peaches=peaches - bought; cout << "You now have" <<peaches<<"peaches" endl } } if(purchaseChoice == 4) { cout << "How many would you like to purchase?" endl cin >> bought; if(bought) { sells = .40 * bought; cout << "You bought" <<bought<< "tomatoes for $" <<sells; tomatoes=tomatoes - bought; cout << "You now have" <<tomatoes<<"tomatoes" endl } } if(purchaseChoice == 5) { cout << "How many would you like to purchase?" endl cin >> bought; if(bought) { sells = .20 * bought; cout << "You bought" <<bought<< "corn for $" <<sells; corn=corn - bought; cout << "You now have" <<corn<<"corn" endl } { (userChoice == 2) { cout << "What type of fruit do you want to sell?" endl << "[1] pears" endl << "[2] apples" endl << "[3] peaches" endl << "[4] tomatoes" endl << "[5] corn" endl cin >> sellChoice; } if(sellChoice == 1) { cout << "How many would you like to sell?" endl cin >> sold; if(sold < 5) { sells = .50 * sold; cout << "You sold" <<sold<< "pears for $" <<sells; pears=pears - sold; cout << "You have" <<pears<<"pears left" endl } else { sells = .40 * sold; cout << "You sold" <<sold<< "pears for $" <<sells; pears=pears - sold; cout << "You have" <<pears<<"pears left" endl } } if(sellChoice == 2) { cout << "How many would you like to sell?" endl cin >> sold; if(sold) { sells = .25 * sold; cout << "You sold" <<sold<< "apples for $" <<sells; apples=apples - sold; cout << "You have" <<apples<<"apples left" endl } } if(sellChoice == 3) { cout << "How many would you like to sell?" endl cin >> sold; if(sold < 5) { sells = .50 * sold; cout << "You sold" <<sold<< "peaches for $" <<sells; peaches=peaches - sold; cout << "You have" <<peaches<<"peaches left" endl } else { sells = .30 * sold; cout << "You sold" <<sold<< "peaches for $" <<sells; peaches=peaches - sold; cout << "You now have" <<peaches<<"peaches left" endl } } if(sellChoice == 4) { cout << "How many would you like to sell?" endl cin >> sold; if(sold) { sells = .40 * sold; cout << "You sold" <<sold<< "tomatoes for $" <<sells; tomatoes=tomatoes - sold; cout << "You have" <<tomatoes<<"tomatoes left" endl } } if(sellChoice == 5) { cout << "How many would you like to sell?" endl cin >> sold; if(sold) { sells = .20 * sold; cout << "You sold" <<sold<< "corn for $" <<sells; corn=corn - sold; cout << "You now have" <<corn<<"corn left" endl } } cout << "You now have" endl <<pears<<"Pears" endl <<apples<<"Apples" endl <<peaches<<"Peaches" endl <<tomatoes<<"Tomatoes" endl <<corn<<"Corn" endl return 0; }



LinkBack URL
About LinkBacks



