I am currently taking a C++ course so I'm a novice. I am trying to complete this project that is giving me much frustration. I am not allowed to use If statements or any loops, which makes it more difficult. here is the code:
The discount will not calculate and i need to know why. plz help me.Code:#include <iostream> using namespace std; float Apple(int numA); double Orange(double numO); int main() { int Apples; int Oranges; cout << "Welcome to the Apples N' Oranges Grocery" << endl; cout << "Apples are $1.00, oranges are $1.50" << endl; cout << "Special on apples, 2 for 1!" << endl; cout << "and, special on oranges, for every orange ordered you get that percent off purchase." << endl; cout << "How many Apples would you like?(must be between 1 and 100)" << endl; cin >> Apples; cout << "How many Oranges do you want?(must be between 1 and 100)" << endl; cin >> Oranges; cout << "You have " << Apples << " apples and " << Oranges << " oranges."<< endl; cout << "Your subtotal is $" << Apple(Apples) + Orange(Oranges) << endl; double discount = (Apple(Apples) + Orange(Oranges)) * (Oranges/100); double Total = (Apple(Apples) + Orange(Oranges))- discount; cout << "Discount $" << discount << endl; cout << "Grand total is $" << Total << endl; return 0; system("PAUSE"); }//The following function gives the price of apples. float Apple(int numA) { int priceA = numA%2; priceA = priceA + (numA/2); return priceA; } //This function calculates the price of oranges. double Orange(double numO) { return 1.50 * numO; }


Reply With Quote


Bookmarks