Hello, i am trying to count from 0 - 7 and storing the values in an array.
I have been trying to do this solidly for 2 weeks :'(
my attempt:
**************************************
int a[20];
int x;
for ( x=0 ; x<=7 ; x++ ) {
a[1] = x;
cout << x << endl; }
***************************************
I know that the output from this program is correct, i.e. it displays:
0
1
2
.
.
7
my problem is a[1] will only display the value inside the for loop's {}. I want to use an array element, a[1] outside of the for { } with those values stored in there. Please help!
Thanks,
John