随笔分类 -  c/c++

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 30 下一页
摘要:1、 #include <stdio.h> #include <ctype.h> int main(void) { int n; unsigned long count = 0; unsigned char buf[16]; FILE *fp; char fname[FILENAME_MAX]; p 阅读全文
posted @ 2021-06-11 12:56 小鲨鱼2018 阅读(57) 评论(0) 推荐(0)
摘要:1、13-11 #include <stdio.h> int main(void) { FILE *fp; int i; double b[10]; double a[] = {0.1,1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1}; if((fp = fopen("tmp 阅读全文
posted @ 2021-06-11 11:50 小鲨鱼2018 阅读(92) 评论(0) 推荐(0)
摘要:c语言向文本文件、二进制文件中写入实数。 1、 #include <stdio.h> int main(void) { FILE *fp; double pi = 3.14159265358979323846; printf("pi from value: %23.21f.\n", pi); // 阅读全文
posted @ 2021-06-11 11:16 小鲨鱼2018 阅读(540) 评论(0) 推荐(0)
摘要:13-8、 #include <stdio.h> int main(void) { FILE *sfp; FILE *dfp; int ch; char sfilename[FILENAME_MAX]; char dfilename[FILENAME_MAX]; printf("Please inp 阅读全文
posted @ 2021-06-11 10:39 小鲨鱼2018 阅读(45) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> int main(void) { FILE *sfp; FILE *dfp; int ch; char sfilename[FILENAME_MAX]; char dfilename[FILENAME_MAX]; printf("Please input 阅读全文
posted @ 2021-06-11 10:00 小鲨鱼2018 阅读(186) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> int main(void) { FILE *fp; int ch; char filename[FILENAME_MAX]; printf("Please input the filename: "); scanf("%s", filename); if 阅读全文
posted @ 2021-06-11 09:33 小鲨鱼2018 阅读(130) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> int main(void) { FILE *fp; int ch; char filename[FILENAME_MAX]; printf("Please input the filename: "); scanf("%s", filename); if 阅读全文
posted @ 2021-06-11 09:13 小鲨鱼2018 阅读(111) 评论(0) 推荐(0)
摘要:1、显示a.txt文件的内容 #include <stdio.h> int main(void) { FILE *fp; int ch; char filename[FILENAME_MAX]; printf("Please input the filename: "); scanf("%s", f 阅读全文
posted @ 2021-06-11 09:04 小鲨鱼2018 阅读(176) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <time.h> void put_data(void) { FILE *fp; if((fp = fopen("time.txt", "r")) == NULL) { printf("\aThe program is ran for t 阅读全文
posted @ 2021-06-11 08:11 小鲨鱼2018 阅读(88) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <time.h> void put_data(void) { FILE *fp; if((fp = fopen("time.txt", "r")) == NULL) printf("\aThe program is running for 阅读全文
posted @ 2021-06-10 23:00 小鲨鱼2018 阅读(163) 评论(0) 推荐(0)
摘要:利用函数库获取当前时间。 1、 #include <stdio.h> #include <time.h> int main(void) { time_t current = time(NULL); struct tm *timer = localtime(&current); printf("cur 阅读全文
posted @ 2021-06-10 22:39 小鲨鱼2018 阅读(596) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> int main(void) { FILE *fp; char name[128]; double height, weight; if((fp = fopen("a.txt", "w")) == NULL) printf("\aFile open fai 阅读全文
posted @ 2021-06-10 21:52 小鲨鱼2018 阅读(64) 评论(0) 推荐(0)
摘要:1、写入日期和时间 #include <stdio.h> #include <time.h> int main(void) { FILE *fp; time_t current = time(NULL); struct tm *timer = localtime(&current); if((fp 阅读全文
posted @ 2021-06-10 21:18 小鲨鱼2018 阅读(1468) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> typedef struct{ char name[128]; double height; double weight; }Type1; void swap(Type1 *x, Type1 *y) { Type1 tmp = *x; *x = *y; * 阅读全文
posted @ 2021-06-10 19:33 小鲨鱼2018 阅读(37) 评论(0) 推荐(0)
摘要:c语言中统计文件字符数 1、 #include <stdio.h> int main(void) { FILE *fp; char c1[128]; int lines = 0; fp = fopen("a.txt", "r"); while(fscanf(fp, "%s", c1) == 1) { 阅读全文
posted @ 2021-06-10 18:25 小鲨鱼2018 阅读(689) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> int main(void) { FILE *fp; int lines = 0; char name[128]; double height, weight; double hsum = 0, wsum = 0; if((fp = fopen("a.tx 阅读全文
posted @ 2021-06-10 18:10 小鲨鱼2018 阅读(8007) 评论(0) 推荐(0)
摘要:13 - 1、 #include <stdio.h> int main(void) { FILE *fp; char filename[FILENAME_MAX]; printf("filename: "); scanf("%s", filename); if((fp = fopen(filenam 阅读全文
posted @ 2021-06-10 17:39 小鲨鱼2018 阅读(89) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> int main(void) { int ch; FILE *sfp; FILE *dfp; char sfile[FILENAME_MAX]; char dfile[FILENAME_MAX]; printf("source file name: "); 阅读全文
posted @ 2021-06-10 11:07 小鲨鱼2018 阅读(37) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <ctype.h> int main(void) { int n; unsigned long count = 0; // count初始值为0, 为什么是unsigned long? unsigned char buf[16]; //字 阅读全文
posted @ 2021-06-10 10:19 小鲨鱼2018 阅读(75) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <time.h> char data_file[] = "datatime.dat"; void get_data(void) { FILE *fp; if((fp = fopen(data_file, "r")) == NULL) pr 阅读全文
posted @ 2021-06-09 18:52 小鲨鱼2018 阅读(50) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 30 下一页