Results 1 to 5 of 5

Thread: Question

  1. #1
    Join Date
    Sep 2017
    Posts
    2
    Platforms
    Windows

    Default Question

    Hi guys , i have a question . Example : i declared 2 int variables .. How do i find which number is minimum and which maximum without using cicles ( for , dowhile , while , if , repeat etc ) ? It is possible ? I asked many people but i didn't find a answer .. Especially in C or C++ .

  2. #2
    Join Date
    Jan 2017
    Posts
    58
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Question

    Do you mean something like this?:
    Qt Code:
    1. int a = 5;
    2. int b = 6;
    3. int minimum = 0, maximum = 0;
    4. minimum = a < b ? a:b;
    5. maximum = a>=b ? a:b;
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Sep 2017
    Posts
    2
    Platforms
    Windows

    Default Re: Question

    No ternary xd

  4. #4
    Join Date
    Jan 2017
    Posts
    58
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Question

    Sounds like a homework problem to me.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. question about xmpp (different question)
    By davinciomar in forum Newbie
    Replies: 9
    Last Post: 6th September 2016, 14:52
  2. Some question in example
    By jhowliu in forum Qt Programming
    Replies: 3
    Last Post: 9th August 2013, 17:24
  3. C++ Question
    By Ashkan_s in forum General Programming
    Replies: 3
    Last Post: 1st March 2013, 12:23
  4. css question
    By Hardstyle in forum Newbie
    Replies: 1
    Last Post: 29th June 2010, 06:29
  5. MVC question
    By ^NyAw^ in forum Qt Programming
    Replies: 5
    Last Post: 17th June 2009, 13:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.