CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    1

    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};

  2. #2
    Join Date
    Jan 2003
    Posts
    615

    Re: Problem with arrays

    Use two for loops.

    Code:
    for(int index1 = 0; index1 < STUDENT; index1++)
    {
        for(int index2 = 0; index2 < NUM_QUIZ; index2++)
        {
            // out data from array
        }
    }
    Before post, make an effort yourself, try googling or search here.

    When posting, give a proper description of your problem, include code* and error messages.

    *All code should include code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured