实验1
Part.1
/*This is first C program*/ # include<stdio.h> int main() { printf("201883300106"); return 0; }
顺利完成初次尝试,但仍然出现了一些错误
Part.2
#include <stdio.h> int main(){ int x; printf("输入一个整数:\n"); scanf("%d",&x); if(x%2==1) printf("是奇数"); else printf("是偶数"); return 0; }
这一次的程序语言更加复杂,编写代码时出现了一些错误
#include <stdio.h> int main(){ int days; printf("输入一个整数:\n"); scanf("%d",&days); if(1<=days&&days<=5) printf("workdays,fighting\n"); else if(days==6||days==7) printf("weekend,relax~\n"); else printf("Ooops, not in 1~7\n"); return 0; }
#include <stdio.h> int main(){ int days; printf("输入一个整数:\n"); scanf("%d",&days); if(days>=1&&days<=5) printf("workdays, fighting\n"); else if(days==6||days==7) printf("weekend, relax~\n"); else printf("Goops, not in 1~7\n"); return 0; }
Part.3
#include <stdio.h> int main(){ char ch; printf("输入一个字符:\n"); scanf("%c",&ch); if(ch>='a'&&ch<='z') ch=ch-32; printf("%c\n",ch); return 0; }
总结,C语言的学习需要规范,需要多加练习,最好能把研究C语言变成一种爱好。