Problem on the range of a data type

S

shuisheng

Dear All,

Is there any way to get the largest or smallest number of a intrinsic
date type in the c++ code?

Thanks,

Shuisheng
 
V

Victor Bazarov

shuisheng said:
Is there any way to get the largest or smallest number of a intrinsic
date type in the c++ code?

Yes, read about 'std::numeric_limits' template.

V
 
D

Daniel T.

shuisheng said:
Is there any way to get the largest or smallest number of a intrinsic
date type in the c++ code?

Yes...

#include <limits>

using std::numeric_limits;
using std::cout;

int main() {
cout << numeric_limits<int>::min() << '\n';
cout << numeric_limits<int>::max() << '\n';

cout << numeric_limits<double>::min() << '\n';
cout << numeric_limits<double>::max() << '\n';
}
 
D

David Harmon

On 29 Sep 2006 10:53:42 -0700 in comp.lang.c++, "shuisheng"
Is there any way to get the largest or smallest number of a intrinsic
date type in the c++ code?

See #include <limits>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top