实验1 C语言开发环境使用和数据类型、运算符、表达式

在刚开始写时,没有理清许多字符的意义,和数据读取的顺序,在第二个实验中的days大于1小于5就写成了1<=days>=5,导致无论输入什么都只输出一种结果。在第三个实验中还有很多不清楚的地方。

#include <stdio.h>
int main(){
    int x;
    printf("输入要一个整数:\n");
    scanf("%d",&x);
if(x%==0);
    printf("是偶数“);
else
    print("是奇数");
return 0;
}
#include <stdio.h>
int main(){
    int days;
    printf("输入一个整数:\n");
    scanf("%d",&days);
if(days>=1&&days<=7);
    printf("workdays, fighting\n");
else if(days==6||days==7)
    printf("weekend, relax~\n");
else
    printf("Goops, not in 1~7\n");
return 0;
}
#include <stdio.h>
int main(){
    char ch;
    printf("输入一个字符:\n");
    scanf("%c",&ch);
if(ch>='a'&&ch<='z');
    printf("这是一个小写字符");
else
    ch+=32;
    printf("%c\n",ch);
return 0;
}

 

posted @ 2019-03-24 15:35  Soledad·QX  阅读(110)  评论(0)    收藏  举报