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;

return 0;

}
char convert(int array[3][2])
{
int i, j=1;
for (i=0; i < 3; i++)
{
if (myarray[i][j] >= 90)
else if (myarray[i][j] >= 80)
else if (myarray[i][j] >= 70)
else if (myarray[i][j] >= 60)
else
}

}
``````

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
2
Views
8 Years
Discussion Span
Last Post by Lerner

First, you will need to learn how to use code tags, see the announcement and the sticky threads at the top of the board, when posting code to this board. Without many of the more respected people who visit this board won't bother to respond to your post because the code looses it's format making difficult to read comfortably.

Second, start another project and do things one step at a time, from the beginning of your instructions. That is, start by declaring a static 2 dimensional array of ints, like you did in your post, and then passing it to a function called getInformtaion(). Obtain your data from within that function using something like this:

``````for (int i=0; i < 3;  i++)
{
cout << "enter course number "<< endl;
cin >> array[i][0];
cout <<"enter number grade" << endl;
cin >> array[i][1];
}``````

When that compiles, then write a funciton to display the array data that was enetered as a numeric value. Then add the function to convert the numeric value to a character value during the display process. And then rewrite the program using dynamic memory to declare the array to be used instead of static memory in the original program. DON'T start at the back end of the progra or create the entire project and then try to correct it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.