2-1

xiaoxiao2021-03-06  57

/ * Write a program to determine the value range of the CHAR, SHORT, INT, INT, and LONG type defined by Signed and Unsigned, and implements two methods in printing standard header files and direct calculation.

#include #include #include #include #define s_print (ch, c_mAx, c_max, s_min, s_max, i_min, i_max, l_min, l_max) / Printf (ch ## ": / n / tchar:% D ~~~% d / n / tshort:% D ~~~% d / n / tint:% D ~~~% d / n / tlong:% D ~~~% d ", / c_min, c_max, s_min, s_max, i_min, i_max, l_min, l_max) #define US_Print (CH, C_MIN, C_MAX, S_MIN, S_MAX, I_MIN, I_MAX, L_MIN, L_MAX) / Printf ( CH ## ": / n / tchar:% u ~~~% u / n / tshort:% u ~~~% u / n / tint:% u ~~~% u / n / tlong:% u ~~ ~% u ", / c_min, c_max, s_min, s_max, i_min, i_max, l_min, l_max) #define min (~ ((((c | 1) << (SizeOf (c) * 8-1)) 1)

INT main (void) {Signed CHAR C = 0; Signed I = 0; Signed Long L = 0; Unsigned Char UC = 0; Unsigned Short US = 0; Unsigned Int UI = 0; unsigned UL = 0; Printf ("Method: / n" by printing standard header file: / n "); s_print (" signed, char_m, char_max, shrt_max, shout_max, int_min, int_max, long_min, long_max); PUTCHAR ('/ n' ); US_PRINT ("unsigned", 0, uchar_max, 0, ushrt_max, 0, uint_max, 0, ulong_max); Printf ("/ N uses direct calculation method: / n"); s_print ("soud", min (c) ), ~ Min (c), min (s), ~ min (i), min (l), ~ min (L)); PUTCHAR ('/ n'); US_Print ("unsigned", 0, ~ uc, 0, ~ us, 0, ~ ui, 0, ~ ul); PUTCHAR ('/ n');

Return 0;}

============================================================================================================================================================================================================= ============

转载请注明原文地址:https://www.9cbs.com/read-117927.html

New Post(0)