This compiles w/o errors but I want it to tell me how many adults, teens, child and infant were entered. Right now, its only giving me a count of the number of functions. What am I doing wrong?
Code:#include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { const int SIZE = 50; int PeopleTypes[SIZE]; int count = 0, i = 0,infant = 0, child = 0,teen = 0, adult = 0; do { cout<< "Enter a number: "; cin >>PeopleTypes[i]; if (PeopleTypes[i]==1 ) cout <<"infant"<<i++<< endl; else if (PeopleTypes[i]==2) cout << " Child"<< i++ << endl; else if (PeopleTypes[i]==3) cout << "Teenager"<<i++<< endl; else if (PeopleTypes[i]==4) cout <<"adults at the school function"<<i++<<endl; else cout << "Invalid Entry!"<<endl; } while (PeopleTypes[i-1]>0); i++; return 0; }



LinkBack URL
About LinkBacks


