Two things in an IF statement

Home Forums C Programming Two things in an IF statement

This topic contains 2 replies, has 2 voices, and was last updated by  GladysMccurry 8 years, 4 months ago.

  • Author
    Posts
  • #2212

    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

    could do something like this:

  • #3593

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

You must be logged in to reply to this topic.

0 Shares
Share
+1
Tweet
Share
Stumble