摘要: 验证性实验二任然正确 #include <stdio.h> #include <stdlib.h> #define N 10 // 定义一个结构体类型STU typedef struct student { int num; char name[20]; int score; }STU; int m 阅读全文
posted @ 2019-12-31 22:01 是罗小黑呀 阅读(152) 评论(3) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> const int N=5; // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int score; 阅读全文
posted @ 2019-12-25 00:07 是罗小黑呀 阅读(107) 评论(3) 推荐(0)
摘要: // 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 i 阅读全文
posted @ 2019-12-17 23:42 是罗小黑呀 阅读(112) 评论(3) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> #define N 1000 int fun(int n,int m,int bb[N]) { int i,j,k=0,flag; for(j=n;j<=m;j++) { flag=1; for(i=2;i<j;i++) 阅读全文
posted @ 2019-12-03 22:43 是罗小黑呀 阅读(137) 评论(3) 推荐(0)
摘要: // 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, r 阅读全文
posted @ 2019-11-18 23:14 是罗小黑呀 阅读(182) 评论(5) 推荐(0)
摘要: lin11中第一个x以宽度8输出,所以不一致。 lin12中第一个f输出时,十进制与二进制转化发生错误。第二个f以8个宽度输出,故不一致。第三个f以宽度8、小数点后精度1输出,故不一致。第三个f以小数点后精度2输出,故不一致。最后一个f以科学计数法并精度为2输出,故不一致。 lin13中m以双精度输 阅读全文
posted @ 2019-11-05 22:06 是罗小黑呀 阅读(167) 评论(3) 推荐(0)
摘要: //程序功能: //要求客户从键盘输入一个整数,判断其是奇是偶 #include <stdio.h> int main(){ int x; printf("输入一个整数:\n"); scanf("%d",&x); if(x%2==0) printf("是偶数"); else printf("是奇数"); return 0; } #include<stdio.h> int main () { int 阅读全文
posted @ 2019-10-21 11:26 是罗小黑呀 阅读(132) 评论(0) 推荐(0)
摘要: #include<stdio.h> int main() { char ch; printf("输入一个字符:\n"); scanf("%c",&ch); if(ch>='a'&&ch<='z') ch=ch-'a'+'A'; printf("%c\n",ch); return 0; } 阅读全文
posted @ 2019-10-21 11:17 是罗小黑呀 阅读(143) 评论(0) 推荐(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| 阅读全文
posted @ 2019-10-21 11:15 是罗小黑呀 阅读(303) 评论(0) 推荐(0)
摘要: //程序功能: //要求客户从键盘输入一个整数,判断其是奇是偶 #include <stdio.h> int main(){ int x; printf("输入一个整数:\n"); scanf("%d",&x); if(x%2==0) printf("是偶数"); else printf("是奇数" 阅读全文
posted @ 2019-10-20 22:38 是罗小黑呀 阅读(92) 评论(0) 推荐(0)