climits how to find max/min int

This is a discussion on climits how to find max/min int within the C++ Programming forums, part of the General Programming Boards category; Sorry I looked in the FAQ, tutorials, and did a search but I don't know how to use <climits> to ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    450

    climits how to find max/min int

    Sorry I looked in the FAQ, tutorials, and did a search but I don't know how to use
    <climits> to determine the max and min an integer can be. Please help!

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Code:
    cout << "max: " << INT_MAX << "\tmin: "<< INT_MIN << endl;

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    Or in <limits>:
    Code:
    #include <limits>
    
    ...
    
    std::numeric_limits<int>::max();

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    thanks Thantos and DaveD

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Yeah I thought about numeric_limits but figured since he said climits I'd limit to that

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 03-10-2008, 12:57 PM
  2. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-24-2007, 12:05 AM
  3. getting a headache
    By sreetvert83 in forum C++ Programming
    Replies: 41
    Last Post: 09-30-2005, 06:20 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 12:58 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM

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