Write a c++ program to count the numbers of adult persons and non adult persons,while we have 18 people..create 2 counters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a c++ program to count the numbers of adult persons and non adult persons,while we have 18 people..create 2 counters

one for adult one for non adult

8th Sep 2017, 4:23 AM
Daravan Daro
Daravan Daro - avatar
4 Answers
+ 7
How are the adults and non-adults determined? In a pre-defined array? User input?
8th Sep 2017, 4:27 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Have you even tried making a program for this? Yes - Show us where you face a problem and we will help you then by solving the problem and then providing you suggestions where you can optimise your code for better results and wider input handling... No - Why not? How will you develop then? Try making something and we'll help you if something works incorrectly or help you improve your code. This way, you'll be a better programmer than before. Please note that this section is for help,suggestions and improvements, not for posting homework... If you disagree, let me know, atleast by a dislike...
8th Sep 2017, 6:25 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 3
For the adult part, you will need : if(age>=18) adult++; else non_adult++; Put this in a do...while() loop to continue reading and stop only when you are done... The counters must be initialized to 0, so that you don't get gibberish.
8th Sep 2017, 6:31 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
user input @hatsy rei
8th Sep 2017, 4:33 AM
Daravan Daro
Daravan Daro - avatar