I am trying to figure out when I enter the data instead of asking for person #1: everytime I can get it to ask person #1: then on the next line person #2: and so on. Here is my code so far:

#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 #1: ";
        cin  >> PeopleTypes[i];
    }
 
    return 0;
}

You already have a counter, so just print that value instead of something hard coded:

cout << "Person #" << i + 1 << ": ";

Thank you. I should have known that!

Does anyone think this program is better set up like I got it or should I use switch or if-else. I have to be able to stop when a negative value is entered and have invalid input displayed if any other integer besides 1,2,3, and 4 are entered.

How many threads are we working with for this program? Maybe you should have only one thread so no one gets confused. Especially you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.