Home Forums C Programming Two things in an IF statement

Viewing 2 reply threads
  • Author
    Posts
    • #2212
      GladysMccurry
      Participant

      I have this program I wrote for a user to enter 5 Integers.
      Now I would like to modify it and determine what position the highest number was entered in.
      Was it the 1st ,2nd, 3rd, 4th or 5th entry that was largest?

      I would like to do something like:
      int count=0;
      -During my statement
      if (number > highNum)
      highNum = number and count++;

      That way when I am done count will be raised to the matching number of the highest entry.
      e.g. if my numbers were 4, 17, 38, 99, 2
      highNum = 99 and count = 4

      I am lost and new to C, I would appreciate any help.
      Thanks

    • #3592
      GWILouisaxwzkla
      Participant

      could do something like this:

    • #3593
      GladysMccurry
      Participant

      Thank you, that is exactly what I was looking for.
      I wish my textbook had an example like that for an If statement.

Viewing 2 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.