Create a program that will create 2X3x3 dimensional array. This program will enable the user to input 3 scores of student1, student2 and student3 for every plane, then will enable to display the average score of each student in the plane.
average my vary depending on the scores inputted by the user
#include<iostream>
using namespace std;
int main(){
int student[2][3][3];
cout<<"Enter the scores for the students\n";
for(int i=0; i<2; i++){
cout<<"The plane\t"<<i+1<<endl;
for(int j=0; j<3; j++){
cout<<"Enter three scores for student \t"<<j+1<<endl;
for(int k=0; k<3; k++){
cin>>student[i][j][k];
}
}
}
double average =0.0;
for(int i=0; i<2; i++){
cout<<"\nThe plane\t"<<i+1<<endl;
for(int j=0; j<3; j++){
cout<<"\nThe student\t"<<j+1<<"\tscores"<<endl;
double sum =0.0;
for(int k=0; k<3; k++){
cout<<"\n"<<student[i][j][k]<<endl;
sum += student[i][j][k];
}
cout<<"Total scores for student\t"<<(j+1)<<"\t"<<sum<<endl;
cout<<"The average score for student\t"<<(j+1)<<"\t"<<sum/3<<endl;
}
}
}
Comments
Leave a comment