I wrote this program and so far so good but now I have to be able to count how many 1's, 2's, 3's, and 4's were entered. I am at a complete loss of where to begin. Could someone help me get started?
Code:#include "stdafx.h" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { const int People = 5; int i, PeopleTypes[People]; 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=0; i<People; i++) { cout << "Person #" << i+1 << ": "; cin >> PeopleTypes[i]; if (PeopleTypes[i]>4 || PeopleTypes[i]<1) { cout << "This is invalid input!\n\n"; } if (PeopleTypes[i]<0) break; } }



LinkBack URL
About LinkBacks


