Files
python/TangDou/CSP-J/J1_2022/UnsignedShort.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

28 lines
989 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
/*
%d 有符号32位整数
%u 无符号32位整数
%lld 有符号64位整数
*/
printf("short:%d bytes,max=%d,min=%d\n", (int)sizeof(short), SHRT_MAX, SHRT_MIN);
printf("unsigned short:%d bytes,max=%d\n", (int)sizeof(unsigned short), USHRT_MAX, 0);
puts("");
printf("int:%d bytes,max=%d,min=%d\n", (int)sizeof(int), INT_MAX, INT_MIN);
printf("unsigned int:%d bytes,max=%u\n", (int)sizeof(unsigned int), UINT_MAX, 0);
puts("");
printf("long long:%d bytes,max=%lld,min=%lld\n", (int)sizeof(long long));
//使用 %lld 就可以打印一个unsigned long long了,glib中的guint64就是unsigned long long。这是GNU编译器支持的。
printf("unsigned long long:%d bytes,max=%lld,min=%d\n", (int)sizeof(unsigned long long));
double a = 1, b = 1;
if (a * b == 1)
printf("True");
else
printf("False");
return 0;
}