写各种控制符输入输出遇到了问题
/*学习目的:
熟悉控制符的输入输出
%d ----- int 范围为-2147483648~+2147483647,4字节
%ld ----- long int 范围为-2147483648~+2147483647,4字节
%c ----- char 范围为-128~127,1字节
%f ----- float 范围为1.175494351E-38,4字节
%lf ----- double 范围为2.2250738585072014E-308,8字节
%x ----- int 或 long int 或 short int(-32768~+32767),4字节
%o ----- 同上
%s ----- 输出一个字符串
%u ----- 以十进制形式输出unsigned型数据(无符号数)
第37章 ----- 2014/12/14 日 - 2014/12/16
*/
#include <stdio.h>
#include <conio.h> //作用于用户通过键盘产生的对应操作
int main(void)
{
int q , w , e , r , d , f , j , s , l;
char t , y , k;
float u;
double p;
//int类型
q = -2147483648UL;
w = 2147483648UL; //为什么这里可以输出超过最大值到48
printf("q = %d w = %d\n",q,w);
//long int类型
e = -2147483648UL;
r = 2147483648UL; //为什么这里可以输出超过最大值到48
printf("e = %ld r = %ld\n",e,r);
//以十六进制形式输出
s = -32768;
l = 32767;
printf("s = %x l = %X\n",s,l);
//以八进制形式输出
d = -32768;
f = 32767;
printf("d = %o f = %O\n",d,f);
//输出一个字符串
char h[5] = "1024";
char g[6] = "Hello"; //C语言中字符串使用数组来存6个字符
printf("h = %s g = %s\n",h,g);
//以十进制形式输出unsigned型数据(无符号数)
j = 2048;
k = '1'; //以ASCLL码形式输出字符,1是49
printf("j = %u k = %u\n",j,k);
//char类型
t = -128;
y = 127;
printf("t = %c y = %c\n",t,y);
//float类型
u = 1.175494351;
printf("u = %f\n",u);
//double类型
p = 2.2250738585072014;
printf("p = %lf\n",p);
getch(); //按下任意键才会继续执行下面的语句
return 0;
}
/*
————————————————————
得出结果:
q = -2147483648 w = -2147483648
e = -2147483648 r = -2147483648
s = ffff8000 l = 7FFF
d = 37777700000 f = O
h = 1024 g = Hello
j = 2048 k = 49
t =