Question: Using the following variables, translate the conditional statements into one line of code in C++ as shown. if() or while() or for() You do not

Using the following variables, translate the conditional statements into one line of code in C++ as shown.

if() or while() or for()

You do not know the values of these variables. You are not answering the questions, you are asking the questions. Assume 28 days in a month. Like Harvest Moon, but with goats.

int tTonsOfPotatoes = ?;

int tTonsOfRadishes = ?;

int tGoats = ?;

float tCashOnHand = ?;

float tMonthlyPay = ?;

float tSpinachCostPerPound = ?;

int tMonthsUntilRetirement = ?;

a.) If I will be a millionaire when I eventually retire

b.) If I can feed my goats 5 pounds of spinach a day each for a month with money I have now

c.) If I can afford to buy enough spinach right now to feed each of my goats 5 pounds a day each for a month

d.) For loop to do something to each pair of radish and potato tons. (Hint: the middle part of a for can have an &&.)

e.) While I still have money

f.) While I have goats and I have more potatoes than radishes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!