6

grade conversion using array & secretary option

view full story
linux-howto

http://www.daniweb.com – Problem: Use a 2 dimensional static array with 3 rows & 2 columns to the course number and number grade you have received in that course. The program should have three functions called get information, printinformation, and convert. You need to send array to getinformation and printinformation functions as parameters. The get information will ask for course no. and their grades and fill up the array. The printinformation function will first print out the course numbers, then will call the convert function to convert the number grade to letter grade and then print out the letter grade. ** After that change your program with dynamic array and decide total number of courses during runtime. My program: #include<string> #include<iostream> using namespace std; char convert(int array[3][2]); int main() { int i, j; int array[3][2]; for (i=0; i < 3; i++) { cout <<"First enter course number and then number grade "<<" : "<<endl; for (j=0; j < 2; j++) { cin >> array[i][j]; } } cout <<" Course Number Number Grade"<<endl; cout <<" _____________ ____________"<<endl; cout <<endl; for (i=0; i < 3; i++) { for (j=0; j < 2; j++) { cout <<" "<< array[i][j]<<" "; } cout <<endl; } for (i=0; i < 3; i++) { int j=0; cout <<"For course CSCE "<<array[i][j]<<" your grade is "; char Agrade[i][j]; int j=1, myarray[3][2]; Agrade[i][j] = convert(myarray[i][j]); cout << Agrade[i][j]<<endl; return 0; } char convert(int array[3][2]) { int i, j=1; for (i=0; i < 3; i++) { char fgrade[i][j]; if (myarray[i][j] >= 90) fgrade[i][j] = 'A'; else if (myarray[i][j] >= 80) fgrade[i][j] = 'B'; else if (myarray[i][j] >= 70) fgrade[i][j] = 'C'; else if (myarray[i][j] >= 60) fgrade[i][j] = 'D'; else fgrade[i][j] = 'F'; return fgrade[i][j]; } } (General)