Confusion about char 你品 你品 你细品


#include<stdio.h>
int main()
{

    int c;

    scanf("%d",&c);

     if(c=='+')
     printf("111");
     else printf("222");

    return 0;

}

测试结果1+
222
Process returned 0 (0x0)   execution time : 4.360 s
Press any key to continue.

测试结果243
111
Process returned 0 (0x0)   execution time : 3.405 s
Press any key to continue.


#include<stdio.h>
int main()
{

    int c;

    scanf("%d",&c);

    printf("%d\n",c);

    return 0;

}

测试结果:
+
15

Process returned 0 (0x0)   execution time : 5.425 s
Press any key to continue.



#include<stdio.h>
int main()
{

    int c;

    char ch;

    scanf("%d",&c);

    ch=c;

    printf("%d\n",c);

    return 0;

}


测试结果:
+
8

Process returned 0 (0x0)   execution time : 5.104 s
Press any key to continue.

发布了34 篇原创文章 · 获赞 38 · 访问量 2650

猜你喜欢

转载自blog.csdn.net/qq_43779149/article/details/104196654