随笔分类 -  c/c++

上一页 1 2 3 4 5 6 7 8 9 10 ··· 30 下一页
摘要:从文件编码的方式来看,文件可分为ASCII码(或unicode)文件和二进制码文件两种。 文本文件是基于字符编码的文件。 二进制文件是基于值编码的文件。 二进制编码的字符(ascii或unicode等)表示文件内容, 是文本文件, 其中包含文本字符内容。 二进制值代表机器语言代码或数值数据、图片、音 阅读全文
posted @ 2021-10-04 20:37 小鲨鱼2018 阅读(807) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { srand((unsigned int) time(0)); int i; for(i = 0; i < 10; i++) { printf("% 阅读全文
posted @ 2021-10-02 20:18 小鲨鱼2018 阅读(978) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> void critic(int * ar1); int main(void) { int num; printf("how many pounds to a firkin of butter? \n"); scanf("%d", &num); while( 阅读全文
posted @ 2021-09-30 22:48 小鲨鱼2018 阅读(90) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #define SIZE 100 void get_n(char * ar, int n); int main(void) { int n; printf("n = "); scanf("%d", &n); while(getchar() != '\n') 阅读全文
posted @ 2021-09-18 10:09 小鲨鱼2018 阅读(89) 评论(0) 推荐(0)
摘要:9、 #include <stdio.h> char *s_gets(char *st, int n); int main(void) { char st1[100]; s_gets(st1, 100); puts(st1); return 0; } char *s_gets(char *st, i 阅读全文
posted @ 2021-09-17 21:47 小鲨鱼2018 阅读(73) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #define MONTHS 12 #define YEARS 5 int main(void) { const float rain[YEARS][MONTHS] = { {4.3, 4.3, 4.3, 3.0, 2.0, 1.2, 0.2, 0.2, 阅读全文
posted @ 2021-09-09 18:32 小鲨鱼2018 阅读(70) 评论(0) 推荐(0)
摘要:复习题 9 #include <stdio.h> void show_menu(void); int getchoice(int low, int high); int main(void) { int res; show_menu(); while((res = getchoice(1,4)) ! 阅读全文
posted @ 2021-09-03 21:45 小鲨鱼2018 阅读(87) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <stdlib.h> int main(void) { int ch; FILE * fp; char filename[128]; int lines; char tail; printf("please input the filen 阅读全文
posted @ 2021-08-29 18:52 小鲨鱼2018 阅读(2031) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <stdbool.h> int main(void) { int ch; char filename[128]; FILE * fp; bool word = 阅读全文
posted @ 2021-08-29 16:49 小鲨鱼2018 阅读(262) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <ctype.h> #include <stdbool.h> int main(void) { char ch; bool word = false; bool space = false; int words = 0; while((c 阅读全文
posted @ 2021-08-29 16:23 小鲨鱼2018 阅读(708) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <stdlib.h> int main(void) { int ch; FILE * fp; char filename[128]; int sum = 0; printf("please input filename: "); scan 阅读全文
posted @ 2021-08-28 23:43 小鲨鱼2018 阅读(103) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> int main(void) { char choice; printf("a) xxxx b) yyyy\n"); printf("c) zzzz q) quit.\n"); printf("input your choice: "); while((c 阅读全文
posted @ 2021-08-27 02:12 小鲨鱼2018 阅读(169) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <stdbool.h> long get_long(void); long square_sum(long num1, long num2); bool get_range(long start, long end, long lower 阅读全文
posted @ 2021-08-27 01:02 小鲨鱼2018 阅读(325) 评论(0) 推荐(0)
摘要:#include <stdio.h> long get_long(void); int main(void) { long num; printf("please input an num: "); num = get_long(); printf("num: %ld.\n", num); retu 阅读全文
posted @ 2021-08-26 01:26 小鲨鱼2018 阅读(682) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main(void) { long num; printf("please input an positive num: "); while(1) { while(scanf("%ld", &num) != 1) { printf("please inp 阅读全文
posted @ 2021-08-26 01:06 小鲨鱼2018 阅读(397) 评论(0) 推荐(0)
摘要:测试程序1: #include <stdio.h> int main(void) { char ch; printf("please input an character: \n"); while((ch = getchar()) != '#') printf("xxx\n"); return 0; 阅读全文
posted @ 2021-08-25 23:07 小鲨鱼2018 阅读(431) 评论(0) 推荐(0)
摘要:c语言中使用程序读取文件。 #include <stdio.h> #include <stdlib.h> int main() { int ch; FILE * fp; char fname[50]; printf("enter the name of the file: "); scanf("%s 阅读全文
posted @ 2021-08-25 01:31 小鲨鱼2018 阅读(627) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <ctype.h> int main(void) { char ch; int n_space = 0, n_lines = 0, n_other = 0; while((ch = getchar()) != '#') { if(ch = 阅读全文
posted @ 2021-08-23 00:25 小鲨鱼2018 阅读(125) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #include <ctype.h> #include <stdbool.h> #define STOP '|' int main(void) { char ch; char prep; long n_ch = 0L; int n_lines = 0; i 阅读全文
posted @ 2021-08-22 15:26 小鲨鱼2018 阅读(439) 评论(0) 推荐(0)
摘要:1、 #include <stdio.h> #define STOP '|' int main(void) { char ch; int chnum = 0; int lines = 0; while((ch = getchar()) != STOP) { if(ch != '\n') chnum+ 阅读全文
posted @ 2021-08-22 12:41 小鲨鱼2018 阅读(912) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 30 下一页