我是初学者程序员。使用 Dev C++ 我需要打印
double
, long long int
, unsigned long long int
, signed long long int
, unsigned int
,的范围unsigned long int
。
到目前为止,我已经这样做了。所有尺寸均以位为单位。
#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
unsigned long int
d = pow(2, sizeof(double) * 8),
lli = pow(2, sizeof(long long int) * 8),
ulli = pow(2, sizeof(unsigned long long int) * 8),
slli = pow(2, sizeof(signed long long int) * 8),
ui = pow(2, sizeof(unsigned int) * 8),
uli = pow(2, sizeof(unsigned long int) * 8);
printf("double%d to %d", -(d / 2), (d / 2) - 1);
printf("longlongint%d to %d", -(lli / 2), (lli / 2) - 1);
printf("unsigned longlongint%d", ulli - 1);
printf("signed long longint%d to %d", -(slli / 2), (slli / 2) - 1);
printf("unsigned int%d", ui - 1);
printf("unsignedlongint%d ", uli - 1);
getch();
return 0;
}
但它仍然没有打印范围......