Tuesday, July 28, 2009

C++ Help plzzzz?

hi all plzz plz i realy need help in doing a C++ program it is not that hard the program is "Analyze a class garading table . the table has the grades of 4 exams for 10 students. The table is initilized in the program . the program finds the minimum , maximum , and average grade for each exam. in addition , the program finds the summation of the best best 3 grades for each student. Hint : to find the best three exams have to find the worst one and then subtract it from the total. " so plzz i realy need the programing languge .. thanx alot ,,, i Need it ASAP .. THANX AGINE :D 10 points for best answer

C++ Help plzzzz?
I can definately help you for this, but only if you could provide full details explaining what do you mean by minimum, maximum and average and best 3. Sorry, I am unable to understand these in current questions.
Reply:Hi, funky





it must be this easy :


port the table into an array..


lets say:





//create an array of integer


int table[10][4];





//initialize the array


//heres actually not needed but in lot of cases


//it aways u from undesirable problem of array programming





int i, j;


for(i = 0; i %26lt; 10; i++)


for(j = 0; j %26lt; 4; j++)


{


table[i][j] = 0;


}





//get the score in


int i, j;


for(i = 0; i %26lt; 10; i++)


for(j = 0; j %26lt; 4; j++)


{


table[i][j] = ...; //the appropriate score for each studs


}





//function to check max...


int checkMax(int Exam)


{


int i, j, max = -1; //considers no score is subZero


for(i = 0; i %26lt; 10; i++)


{


if(table[i][Exam] %26gt; max) max = table[i][Exam];


}


return max;


}





//Recount the loop to get the score's archiver id


//represented by variable i


int i, j, best[4];


for(i = 0; i %26lt; 10; i++)


for(j = 0; j%26lt; 4; j++)


{


if(table[i][j] == checkMax(j))


{


best[j] = i;


break;


}


}





//Now you get the id of the best for each


//To count the minimum, change the max = -1 into min = 101


//assuming no score will reach more than 100


//and of course some other appropriate logics (like %26gt; to %26lt;, etc)


//To count the best three, with a little more effort you should find the answer ;)





HTH--,


niccie_11


No comments:

Post a Comment