Programming - U2 ( Array & String )
Programming - U2 ( Array & String )
char letters[26];
double atomic_weights[SIZE];
float heights[num_people];
float areas[34.4];
cin>>>>age[0]>>age[1]>>age[2]>>age[3];
12.0
To access an element of the array, we use two
subscripts – one for the column and one for the row.
Example:
score[1][2] = 12.0;
cout<<score[2][3]<<endl;
2D arrays and nested for loops
This code will take from the user the scores of 80 students
for 4 courses
2D arrays and nested for loops
This code will average the scores of the 4 courses for each
student and stores the results in a one dimensional array.
2D arrays and nested for loops