Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Problem with Arrays (http://www.go4expert.com/forums/problem-with-arrays-t19912/)

dldsob 29Oct2009 04:55

Problem with Arrays
 
I declared 4 different arrays. I dont know how to display all the arrays. Can anyone please help me with this? I want to display all 4 arrays like this:


Student 1 2 3 4 5 6 7 Time Status Final

1 0 0 0 0 0 0 0 6.50 B 0
2 5 6 7 8 2 1 3 4 C 0
3 0 0 0 0 0 0 0 7.50 B 0
4 3 4 5 1 2 9 4 12 A 0






const int NUM_STUDENT = 4;
const int NUM_QUIZ = 7;
int student = 0;
int quiz = 0;
double grade[NUM_STUDENT][NUM_QUIZ] = {{0, 0, 0, 0, 0, 0, 0},
{5, 6, 7, 8, 2, 1, 3},
{0, 0, 0, 0, 0, 0, 0},
{3, 4, 5, 1, 2, 9, 4}};

double time[4] = {9, 10.5, 10.5, 12};
char status[4] = {'B', 'C', 'B', 'A'};
double final [4] = {0, 0, 0, 0};

xpi0t0s 29Oct2009 12:34

Re: Problem with Arrays
 
I would suggest using a printf or cout statement within a for loop.
e.g.
Code:

for (int i=0; i<4; i++)
  printf("%c ",status[i]);



All times are GMT +5.5. The time now is 13:32.