PleaseI need help with this Lanuage C Please give comment in
Please....I need help with this.....
Lanuage: C++ (Please give comment in each line and attached a successful output screen shot.
********************************************************************************************************************
Write a program the uses 20 variables and an array of 20 variables.
In this program, declare 20 individual variables.
Write 20 different cout and cin statements so a user can be prompted to input a number into each variable. Write 20 cout statements that print out the content of each variable.
After you get the above working, add to the program...
Declare a single integer array of 20 variables, initialize them all to 0.
Use a loop to have the user prompted to enter a value for each variable in the array. Use a loop to print the 20 values of the integer array.
Which method has less code, and is simpler.
Solution
Answer:-
#include <iostream>
using namespace std;
const int arraylist = 20;
typedef int List_array[arraylist];
int main()
{
List_array size;
int count;
for (count = 1 ; count <= arraylist ; count++)
{
cout << \"Array Variable list :\" << count << \"\ \";
cin >> size[count - 1];
}
return 0;
}
