climits error

I wrote following code and found following error while compiling with gcc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <climits>
#include <limits.h>

using namespace std;

int main()
{
	cout << "datatype\t\tmax\t\tmin\n";
	cout << "--------\t\t---\t\t---\n";
	cout << "int\t\t" << INT_MAX << "\t\t" << INT_MIN << endl;
	cout << "short int\t\t" << SHRT_MAX << "\t\t" << SHRT_MIN << endl;
	cout << "float\t\t" << FLT_MAX << "\t\t" << FLT_MIN << endl;
	cout << "double\t\t" << DBL_MAX << "\t\t" << DBL_MIN << endl;
	cout << "char\t\t" << CHAR_MAX << "\t\t" << CHAR_MIN << endl;

	return 0;
}

p.cpp: In function 'int main()':
p.cpp: 13: error: 'FLT_MAX' was not declared in this scope
p.cpp: 13: error: 'FLT_MIN' was not declared in this scope
p.cpp: 14: error: 'DBL_MAX' was not declared in this scope
p.cpp: 14: error: 'DBL_MAX' was not declared in this scope


what is wrong with this code?
Topic archived. No new replies allowed.