摘要: #include <stdio.h> #include <stdlib.h> int main() { FILE *fin, *fout; // 定义文件类型指针 int ch; fin = fopen("file1.txt", "r"); // 以只读文本方式打开文件file1.txt if (f 阅读全文
posted @ 2021-06-16 23:51 freshwatercd 阅读(38) 评论(1) 推荐(0) 编辑
摘要: #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 4 typedef struct student { int id; /*学生学号 */ char name[20]; /*学生姓名 */ char subject[2 阅读全文
posted @ 2021-06-08 19:20 freshwatercd 阅读(38) 评论(1) 推荐(0) 编辑
摘要: 1 #include<stdio.h> const int N=3; int main(){ int a[N] = {1, 2, 3}; int i; printf("通过数组名和下标直接访问数组元素:\n"); for(i=0; i<N; i++) printf("%d: %d\n", &a[i] 阅读全文
posted @ 2021-05-24 15:55 freshwatercd 阅读(55) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> long long fun(int n); // 函数声明 int main() { int n; long long f; while (scanf_s("%d", &n) != EOF) { f = fun(n); // 函数调用 printf("n = % 阅读全文
posted @ 2021-04-28 22:09 freshwatercd 阅读(36) 评论(1) 推荐(0) 编辑
摘要: // 生成N个0~99之间的随机整数,并打印输出 #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 5 int main() { int x, n; srand(time(0)); // 以当前系统时间作为随机种子 阅读全文
posted @ 2021-04-12 23:24 freshwatercd 阅读(56) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> #include<stdlib.h> int main() { int num; scanf("%d", &num); printf("2049%04d\n", num); scanf("%d", &num); printf("2049%04d\n", num) 阅读全文
posted @ 2021-03-29 17:29 freshwatercd 阅读(53) 评论(2) 推荐(0) 编辑
摘要: //按行打印两个小人 #include<stdio.h> int main(){ printf(" O O\n"); printf("<H> <H>\n"); printf("I I I I\n"); return 0; } #include <stdio.h> /*用c语言运行一个简单的运算 */ 阅读全文
posted @ 2021-03-15 18:01 freshwatercd 阅读(75) 评论(0) 推荐(0) 编辑