(1)
main()
{
int a,b;
a=32767;
b=a+1;
printf("\na=%d,a+1=%d\n",a,b);
a=-32768;
b=a-1;
printd("\na=%d,a-1=%d\n",a,b);
getch();
}
(2)
main()
{
char c1,c2,c3;
c1='a';
c2='b';
c1=c1-32;
c2=c2-32;
c3=130;
printf("\n%c %c %c\n",c1,c2,c3);
printf("%d %d %d\n",c1,c2,c3);
getch();
}
注解下..謝謝了
main()
{
int a,b; /*定義兩個整型變量a,b*/
a=32767; /*整型變量a賦初值*/
b=a+1; /*整型變量b用表達式賦值*/
printf("\na=%d,a+1=%d\n",a,b); /*換行並打印 a= ,a+1 =,其中,a=後面跟變量a的值,a+1後面跟變量b的當前值*/
a=-32768; /*再次對變量a賦初值*/
b=a-1; /*再次用表達式對變量b賦值*/
printd("\na=%d,a-1=%d\n",a,b); /*換行並打印 a= ,a-1 =,其中,其中,a=後面跟變量a的值,a-1後面跟變量b的當前值*/
getch(); /*調用庫函數getch()*/
}
(2)
main()
{
char c1,c2,c3; /*定義三個字符變量*/
c1='a'; /*為字符變量c1賦初值*/
c2='b'; /*為字符變量c2賦初值*/
c1=c1-32; /*用表達式為字符變量c1賦值*/
c2=c2-32; /*用表達式為字符變量c2賦值*/
c3=130; /*為字符變量c3賦初值*/
printf("\n%c %c %c\n",c1,c2,c3); /*換行並打印字符變量c1,c2,c3的值,打印完再換行*/
printf("%d %d %d\n",c1,c2,c3); /*打印字符變量c1,c2,c3的值為對應的數值格式*/
getch(); /*調用庫函數getch()*/
}