I have to make a program that enters either a 1, 2, 3, or 4 for 50 people attending a function. Then I have to be able to count how many of each 1's, 2's ,3's, and 4's there were. My 2 questions are:
1.) Would this program be better as a while loop so it is continous or a for loop?
2.) How could I start code to count each individual category?
#include "stdafx.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const int People = 5;
int i, PeopleTypes[People], count=0;
cout << "Enter 1 for Infant, 2 for Child, 3 for Teenager, or 4 for Adult\n";
cout << "for each person that attended the school function.\n\n";
for(i=1; i<People; i++)
{
cout << "Person #" << i << ": ";
cin >> PeopleTypes[i];
if (PeopleTypes[i]>4 || PeopleTypes[i]<1)
{
cout << "This is invalid input!\n\n";
}
if (PeopleTypes[i]<0)
break;
}
}