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

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"
A simple if seems like it would work here.
Thats my prob. I can't seem to figure out the right syntax. Thats what I'm asking.
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.