Answer:
Follows are the code to this question:
#include <iostream>//defining header file
using namespace std;
int main() //defining main method
{
const int NUM_GUESSES = 3;//defining an integer constant variable NUM_GUESSES
int userGuesses[NUM_GUESSES];//defining an array userGuesses
int i = 0;//defining integer variable i
for(i=0;i<NUM_GUESSES;i++)//defining for loop for input value
{
cin>>userGuesses[i];//input array from the user end
}
for (i = 0; i < NUM_GUESSES; ++i)//defining for loop fore print value
{
cout <<userGuesses[i] << " ";//print array value with a space
}
return 0;
}
Output:
9
5
2
9 5 2
Explanation:
In the above-given program, an integer constant variable NUM_GUESSES is defined that holds an integer value, in the next step, an integer array "userGuesses" is defined, which holds NUM_GUESSES value.
In the next step, two for loop is defined, in the first loop, it is used for an input value, and in the second loop, it prints the array value.