Thread: 2D array loop...Help needed

  1. #1
    Registered User
    Join Date
    Feb 2014
    Posts
    18

    2D array loop...Help needed

    Write a program that accepts the name and ID number of 5 students and stores them in an array. After
    all the students have been entered, the application should display the title “Student Roster” and then list the names in the array. 2D array

    This is what i have so far but i dont know how to put it in a loop rather than type everything for each column and row..can someone help me please.

    Code:
    #include <cstdlib>
    #include <iostream>
    #include <string> 
    
    
    using namespace std;
    
    
    int main()
    {
        string students[5][3];
        
        cout << "Enter ID#: ";
        cin >> students[0][0];
        
        cout << "Enter First name: ";
        cin >> students[0][1];
        
        cout << "Enter Last name: ";
        cin >> students[0][2];
        
        
        cout << "STUENTS ROSTER" << endl;
    
    
        cout << students[0][0];
          
        system("PAUSE");
        return 0;
    }

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c# help needed with a mix of loop terminated sentinal
    By xbox221 in forum C# Programming
    Replies: 6
    Last Post: 01-10-2011, 09:23 PM
  2. 2D array, help needed
    By banny in forum C Programming
    Replies: 6
    Last Post: 06-13-2008, 10:11 AM
  3. decrementing for loop help needed
    By adamuk in forum C Programming
    Replies: 5
    Last Post: 01-17-2006, 02:29 PM
  4. loop needed also how to make input use letters
    By LoRdHSV1991 in forum C Programming
    Replies: 3
    Last Post: 01-13-2006, 05:39 AM
  5. help needed on loop ??
    By bezzler in forum C Programming
    Replies: 3
    Last Post: 07-08-2005, 07:27 AM

Tags for this Thread