Thread: How to compare values?

  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    2

    How to compare values?

    If I put: -- while(scanf("%d", &a) --
    and then input how much values that i want, how can I compare:
    The first one with the second one, the second one with the third one, the third one with the fourth one, the fourth one with the fifth one and so on?
    Note: No arrays included.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,667
    Like

    while ( scanf("%d", &a) == 1 && a < b ) b = a;
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 03-29-2015, 05:30 AM
  2. Replies: 13
    Last Post: 07-27-2013, 10:20 AM
  3. How to compare, without using compare (homework)
    By Mr.777 in forum C++ Programming
    Replies: 8
    Last Post: 03-07-2011, 02:55 AM
  4. compare with chars && compare with int
    By zcrself in forum C Programming
    Replies: 1
    Last Post: 04-22-2010, 03:19 AM
  5. DIFF doesn't compare numerical values?
    By patiobarbecue in forum C Programming
    Replies: 1
    Last Post: 02-11-2010, 11:44 PM

Tags for this Thread