摘要: Part1 验证性实验2:运行结果正确 二进制文件和文本文件的区别: 二进制文件内容不可读,文本文件内容可读 #include <stdio.h> #include <stdlib.h> #define N 10 typedef struct student { int num; char name 阅读全文
posted @ 2019-12-29 12:19 沈钰琳 阅读(169) 评论(7) 推荐(0)
摘要: Part 1: #include <stdio.h> #include <stdlib.h> const int N=5; // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int 阅读全文
posted @ 2019-12-22 16:20 沈钰琳 阅读(158) 评论(2) 推荐(0)
摘要: // 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 i 阅读全文
posted @ 2019-12-15 21:55 沈钰琳 阅读(114) 评论(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 19:28 沈钰琳 阅读(130) 评论(3) 推荐(0)
摘要: Part2: #include <stdio.h> #include <stdlib.h> int main() { int number, max, min, n; n=1; printf("输入第%d个数: ", n); scanf("%d", &number); max = number; m 阅读全文
posted @ 2019-11-16 17:40 沈钰琳 阅读(168) 评论(3) 推荐(0)
摘要: Part1: ex2_1.cpp: 程序运行后,各个变量的值与代码中赋给变量的初始值有一个不一致,printf("%f,%8f)的结果为123.456001 解释:f系统默认小数部分输出6位小数,计算机读取数据时转化为二进制,再转化为十进制输出,过程会出现数据的偏差。 ex2_2.cpp: #inc 阅读全文
posted @ 2019-11-05 23:03 沈钰琳 阅读(256) 评论(4) 推荐(0)
摘要: 最初会忘记编译预处理 会时不时忘记分号 刚开始return0间没有打空格 输入中文后忘记切换成英文,导致后面几个符号都是错误的 不清楚scanf("%d",&x)中&的作用 有些只是机械的按书本将代码打上去,并不清楚细节的含义 Part2: 判断奇偶 根据不同的输入,显示不同提示信息: 根据用户输入 阅读全文
posted @ 2019-10-22 22:06 沈钰琳 阅读(122) 评论(0) 推荐(0)