Thread: While loop with variable problem

  1. #31
    Registered User
    Join Date
    Apr 2008
    Posts
    122
    I know you guys probably think I am completely dumb in the field of c++ but I need more help .

    I now need to ADD to the array a name, id and score. I thought I had a brilliant idea as a way to do this but it isn't working. Here is my code:

    Code:
    void addIt (ifstream& inFile, studentType studentList[], int& counter, string& name,
                 int& id, int& score2)
    {
         
         cout << "\nPlease enter a name: ";
         cin >> name;
         
         cout << "\nPlease enter an ID: ";
         cin >> id;
         
         cout << "\nPlease enter a score: ";
         cin >> score2;
         
         studentList[counter + 1].Name = name;
         studentList[counter + 1].ID = id;
         studentList[counter + 1].score = score2;
    
         }

  2. #32
    Registered User
    Join Date
    Apr 2008
    Posts
    122
    Can anyone help?

  3. #33
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Todd88 View Post
    Can anyone help?
    We'd be glad to help, but you have to tell us what the problem is.

  4. #34
    Registered User
    Join Date
    Apr 2008
    Posts
    122
    I figured it all out by myself. Thanks for looking guys!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. weired problem in while loop
    By avisik in forum C Programming
    Replies: 14
    Last Post: 12-01-2008, 01:41 PM
  2. Problem with a loop
    By wiggsfly in forum C Programming
    Replies: 5
    Last Post: 11-30-2008, 12:45 PM
  3. Problem with for loop
    By irsmart in forum C++ Programming
    Replies: 3
    Last Post: 09-29-2006, 04:26 PM
  4. having problem with string statement during a loop!
    By Hp7130p in forum C++ Programming
    Replies: 5
    Last Post: 04-21-2005, 09:40 AM
  5. While loop problem
    By nadkingcole in forum C Programming
    Replies: 2
    Last Post: 05-09-2002, 06:14 AM