Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

Suppose a teacher weights the four exams he gives 10%, 25%, 30%, and 35%. Write a program that reads ten sets of four grades. i just need an explaination on how I would write the code to read ten sets of four grades. It is also supposed to be a global variable I need an in-depth explanation on how to write the program not the code it self.

OpenStudy (anonymous):

you can take a two dimentional array 10 x 4 and you an save elements in that array now for 1st grade marks = first grade marks * 0.10 for second grade marks = second grade marks * 0.25 and others same like this

OpenStudy (anonymous):

@nick67 do you know how to do this program this is what i have so far #include<iostream> using namespace std; const int NUMVALUES=5; int main() { int Test1, Test2, Test3, Test4, sum, i, number; sum=0; for(i=1;i<=number;i++) { cout<<"enter a value"<<endl; cin>>Test1>>Test2>>Test3>>Test4; sum=sum+Test1+Test2+Test3+Test4; cout<<"the average is "<<sum/NUMVALUES<<endl; } }

OpenStudy (nick67):

@Jas11 You may follow the indication by xaadi1993 over here, in order to save data into a multidimensional array; you could "write the code to read ten sets of four grades" using two nested loops: the outer one with length 10 (the number of students, I suppose) and the inner one with length 4 (the grades each student received in the four exams). Hope this could be useful :-)

OpenStudy (anonymous):

@nick67 am i on the right track #include<iostream> using namespace std; const int NUMVALUES=10 int main() { sum=0; int i; double number; float marks[10][4]={0}; cout<<"enter the valuse of the four letter grades"<<endl; for(i=1;i<=10;i++)

OpenStudy (nick67):

well, you need another loop into the first one; so use another for cycle that runs from 1 to 4, then in that loop write the input instruction (cin>>) to fill the matrix "marks" , using proper indexes to point to the correct position in the matrix.

OpenStudy (anonymous):

@nick67 like this #include<iostream> using namespace std; const int NUMVALUES=10; int main() { sum=0; int i; double number; float value[10][4]={0}; int t1,t2,t3,t4; cout<<"enter the valuse of the four letter grades"<<endl; for(i=1;i<=10;i++) { for(i=0;i<=4;i++) { cout<<"enter the value of the test scores"<<endl; cin>>t1<<t2<<t3<<t4; sum=sum+number; cout<<"the average is "<<sum/NUMVALUES<<endl; } } return 0; }

OpenStudy (nick67):

@Jas11 sorry Jas11, but you need 2 different variables for the 2 for cycles (i, j for instance) and then you have to fill the matrix using something like that: #include <iostream> using namespace std; int main() { int marks[10][4]; int i, j; for(i=0; i<10; i++) for(j=0; j<4; j++) { cout << "Type mark " << j+1 << " for student n° " << i+1; cin >> marks[i][j]; } return 0; } Now you have to elaborate data in the matrix :-)

OpenStudy (anonymous):

ok

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!