Write the C++ code (NOT a full program) that prompts the user to enter 50 numbers and fills the array guestCount with these 50 numbers, so that the first number input is in the first element of the array, the second input in the second element, etc.

Respuesta :

Answer:

The code is as follows:

int guestCount[50];

   for(int i = 0; i<50;i++){

       cout<<"guestCount "<<i+1<<": ";

       cin>>guestCount[i];

   }

Explanation:

This declares the array

int guestCount[50];

This iterates through the array (50 elements)

   for(int i = 0; i<50;i++){

This prompts the user for each array element

       cout<<"guestCount "<<i+1<<": ";

This gets the input from the user

       cin>>guestCount[i];

   }