Sunday, September 15, 2013

Data types and their maximum values

The code below will give you the maximum values of items under c++11. Note you need a long long for Project Euler problem 3 Cpp reference also gives the types and the expression. However I don't really understand the syntax some_phrase::function() etc - remember to look out for this. Looks like there are many numeric_limits that can be accessed beyond max.
#include <iostream>
#include <limits>


using namespace std;

int main()
{
    cout << numeric_limits<unsigned long long>::max();
    return 0;
}

No comments:

Post a Comment