While loop with variable problem

This is a discussion on While loop with variable problem within the C++ Programming forums, part of the General Programming Boards category; I know you guys probably think I am completely dumb in the field of c++ but I need more help ...

  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,185
    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!

Page 3 of 3 FirstFirst 123
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, 12:41 PM
  2. Problem with a loop
    By wiggsfly in forum C Programming
    Replies: 5
    Last Post: 11-30-2008, 11:45 AM
  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21