摘要: 验证性实验二:更改之后,程序依旧可以运行 part2: #include <stdio.h> #include <stdlib.h> #include <string.h> const int N = 10; // 定义结构体类型struct student,并定义其别名为STU typedef s 阅读全文
posted @ 2019-12-27 12:38 电信13班范浩 阅读(142) 评论(3) 推荐(0)
摘要: 第一个程序: #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-18 16:35 电信13班范浩 阅读(131) 评论(3) 推荐(0)
摘要: // 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include<stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 in 阅读全文
posted @ 2019-12-16 13:19 电信13班范浩 阅读(93) 评论(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-11-30 15:00 电信13班范浩 阅读(78) 评论(2) 推荐(0)
摘要: #include<stdio.h> int main() { long int x,y,t,i; i = 1; y = 0; printf("Enter a number: "); scanf("%ld",&x); while(x != 0) { t = x % 10; x = x / 10; if 阅读全文
posted @ 2019-11-15 22:30 电信13班范浩 阅读(98) 评论(2) 推荐(0)
摘要: part1第一个程序:第一行和第二行与初始值一致; 第三行前一个有修饰符“8”,宽度为8;后一个因为修饰符“2”小于原有宽度,所以输出值和初始值一直; 第四行是float类型,第一个一致,第二个有修饰符“8”,第三个修饰符“8.1”,宽度8,只保留一位小数,第四个只输出两位小数,第五个有修饰符“.2 阅读全文
posted @ 2019-11-01 23:43 电信13班范浩 阅读(106) 评论(3) 推荐(0)
摘要: part1:VS 2019中scanf()需要改为scanf_s(),且同一个方案中只能有一个主程序,即便不在同一个源文件里也不行,这个需要尤其的注意; return 0后面一定要有“;”,容易被忽略。part2:part1: #include<stdio.h>int main(){ int x;  阅读全文
posted @ 2019-10-18 23:39 电信13班范浩 阅读(85) 评论(0) 推荐(0)