Like Tree2Likes

Please check my code

This is a discussion on Please check my code within the C Programming forums, part of the General Programming Boards category; From your second while loop... Note that you are declaring idNum but never intializing it to a value. Code: while ...

  1. #16
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    From your second while loop...
    Note that you are declaring idNum but never intializing it to a value.

    Code:
       while (e==1)
        {
         int scoreCheck,idNum;
         id[ctr]=idNum;
         scoreCheck=searchInt(id,ctr,idnbr);
    If you wanted to use the one declared at the top of main (which would make sense) you should not redeclare it here.
    Last edited by CommonTater; 04-25-2011 at 05:12 AM.

  2. #17
    Registered User
    Join Date
    Apr 2011
    Posts
    5
    Ok, I took all of the advice you all posted but for some reason my code still isn't printing the proper results. It only prints not found.
    CommonTater, what I'm trying to do in the second while loop is read in the second infile, which is supposed to be an array of integers, i.e. 5 2 7 which are also the same id numbers from the first infile. Then using those numbers it searches the first array from the first infile and locates the id numbers 5 2 7. Here's where I'm not really sure what is supposed to happen, I think once it locates those Id numbers it is supposed to return and print out the id numbers and the corresponding scores from the first infile. The first infile has Id numbers and scores, the variables for them are id and score, the second infile only has the id numbers.

  3. #18
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by foxx2jett View Post
    Here's where I'm not really sure what is supposed to happen,
    Then you are not fully prepared to write this program. I don't care what a person's IQ is or how much schooling with a comp-sci major they have, I don't even care if they came up through the school of hard knocks... there isn't a programmer alive who can write a solution to a problem he doesn't understand...

    You would probably be well served to sit down and work this problem on paper until you understand what's supposed to happen...
    (hint: It will probably turn out that you need to load both files into arrays and work from there.)

  4. #19
    Registered User
    Join Date
    Apr 2011
    Posts
    5
    Ok, will do. I'll see if I can figure it out.

    Thanks all. I appreciate your help.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help! Check my code over.
    By omGeeK in forum C Programming
    Replies: 6
    Last Post: 11-05-2010, 12:34 AM
  2. Would you check my code, please?
    By maLio3 in forum C Programming
    Replies: 8
    Last Post: 08-24-2010, 01:39 PM
  3. check this code out
    By abyssphobia in forum C++ Programming
    Replies: 9
    Last Post: 08-15-2004, 08:31 PM
  4. Code Check
    By Ajsan in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2004, 10:01 PM
  5. Can anyone check this code
    By a_learner in forum C Programming
    Replies: 5
    Last Post: 10-06-2001, 03:41 PM

Tags for this Thread


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