buy 51 apples but only only 50 left so buy them and print message.

Nov 8, 2010 at 10:42pm
So I'm trying to do this program where customers buy apples from a market. Theres a limited number of apples. I want to be able to print a message that if the customer buys more than the current stock to buy all the remaining apples and print message that only the remaining apples were bought. "Order 51 apples", "sorry only 50 apples of the needed 51 apples where bought because out of stock"
Nov 8, 2010 at 10:56pm
A simple if seems like it would work here.
Nov 8, 2010 at 11:27pm
Thats my prob. I can't seem to figure out the right syntax. Thats what I'm asking.
Nov 9, 2010 at 1:16am
1
2
if (ApplesToBuy > CurrentApples)
  std::cout << "There aren't enough apples, only " << CurrentApples << " were bought." << std::endl;


You should learn the language before you dive into projects.
Topic archived. No new replies allowed.