Program takes 5 numbers from a user from console stores the

 // Program takes 5 numbers from a user (from console), stores them into an // array, and then prints them to the screen (on the same line).  // Add code to complete this program. You only need to add code where indicated // by \"ADD HERE\".  #include <iostream> using namespace std;  int main() {         const int SIZE = 5;  // size of array          // ADD HERE - create an array of integers that will hold 5 integers.           cout << \"please enter 5 integers : \" << endl;          // For loop takes 5 integers from user and stores them in the array         for (int i = 0 ; i < SIZE ; i++)         {                 // ADD HERE - take user\'s input and store it in the array you created                           }          // ADD HERE - Write a for loop to print the array to the screen           return 0; 

Solution

#include <iostream>

using namespace std;

int main()

{

        const int SIZE = 5; // size of array

      int a[size];

        cout << \"please enter 5 integers : \" << endl;

        // For loop takes 5 integers from user and stores them in the array

        for (int i = 0 ; i < SIZE ; i++)

        {

          cin>> a[i];

       

       

        }

for (int i = 0 ; i < SIZE ; i++)

        {

          cout >> a[i];

       

       

        }

        return 0;

}

 // Program takes 5 numbers from a user (from console), stores them into an // array, and then prints them to the screen (on the same line). // Add code to comp

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site