Question

Use only C++ languages, please!!! Assume: int age; int minors = 0; int adults = 0;...

Use only C++ languages, please!!!

Assume:

int age;

int minors = 0; int adults = 0; int seniors = 0;

Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 inclusive, and adds 1 to the variable seniors if age is 65 or older.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer

if (age < 18)
    minors++;
else if(age <= 64)
    adults++;
else
    seniors++;
Add a comment
Know the answer?
Add Answer to:
Use only C++ languages, please!!! Assume: int age; int minors = 0; int adults = 0;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT