09 2021 档案

摘要:自动售货机 #include <stdio.h> /* 通过商品索引 返回价格 */ int goods_price(int index){ switch (index) { case 1:case 2:case 3: return 1; break; case 4:case 5: return 2 阅读全文
posted @ 2021-09-30 14:03 就是想学习 阅读(32) 评论(0) 推荐(0) 编辑
摘要:第六题 输出文件中的注释:将C语言源程序(hello.c)文件中的所有注释去掉后存入另一个文件(new_hello.c)。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #define MA 阅读全文
posted @ 2021-09-29 15:18 就是想学习 阅读(70) 评论(0) 推荐(0) 编辑
摘要:第五题 输出含for的行:将文本文件test.txt中所有包含字符串"for"的行输出. #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #define MAXN 5000 int main( 阅读全文
posted @ 2021-09-29 14:36 就是想学习 阅读(105) 评论(0) 推荐(0) 编辑
摘要:第四题 将文件中的数据求和并写入文本文件尾:文件Int_Data.dat中存放了若干整数,将文件中所有数据相加,并把累加和写入该文件的最后。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(void){ int n 阅读全文
posted @ 2021-09-29 14:17 就是想学习 阅读(251) 评论(0) 推荐(0) 编辑
摘要:3.比较两个文本文件是否相等:比较两个文本文件的内容是否相同,并输出两个文件中第一次出现不同字符内容的行号及列值。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(void){ int row, column; c 阅读全文
posted @ 2021-09-29 11:47 就是想学习 阅读(97) 评论(0) 推荐(0) 编辑
摘要:第二题 将实数写入文件:从键盘输入若干实数(以特殊数值-1结束),分别写到一个文本文件中。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(void){ double number; FILE *fp; if (( 阅读全文
posted @ 2021-09-29 11:06 就是想学习 阅读(283) 评论(0) 推荐(0) 编辑
摘要:第一题:统计文本文件中各类字符个数:分别统计一个文本文件中字母、数字及其其它字符的个数。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(void){ int alphabet, digit, other; cha 阅读全文
posted @ 2021-09-29 10:46 就是想学习 阅读(170) 评论(0) 推荐(0) 编辑
摘要:#include <string.h> #include <stdlib.h> #include <stdio.h> long size; struct LogData{ long logid; char logdate[11]; char lognote[15]; double charge; d 阅读全文
posted @ 2021-09-28 00:15 就是想学习 阅读(86) 评论(0) 推荐(0) 编辑
摘要:实数取整写入文件 #include <stdio.h> #include <stdlib.h> #define MAXN 300 int main(void){ int i,j; FILE *fp, *fp1; double nums[MAXN]; if ((fp=fopen("f1.txt", " 阅读全文
posted @ 2021-09-27 17:03 就是想学习 阅读(79) 评论(0) 推荐(0) 编辑
摘要:写字符并验证 #include <stdio.h> #include <stdlib.h> #define MAXN 300 int main(void){ FILE *fp; char ch; char string[MAXN]; gets(string); if ((fp=fopen("f3.t 阅读全文
posted @ 2021-09-27 16:32 就是想学习 阅读(53) 评论(0) 推荐(0) 编辑
摘要:字母转换并统计行数 #include <stdio.h> #include <stdlib.h> int main(void){ char ch; int enter_count; FILE *fp; enter_count = 0; if ((fp=fopen("f12-2.txt", "r")) 阅读全文
posted @ 2021-09-27 16:11 就是想学习 阅读(68) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <string.h> #include <stdlib.h> #define SIZE 5 struct sysuser{ char username[20]; char pwssword[8]; }; void encrypt_(char * 阅读全文
posted @ 2021-09-27 15:53 就是想学习 阅读(61) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> struct sysuser{ char username[20]; char password[8]; }; void encrypt_(char *pwd); int check 阅读全文
posted @ 2021-09-27 15:10 就是想学习 阅读(85) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> int main(void){ FILE *fp1, *fp2; char ch; if ((fp1 = fopen("f12-2.txt", "r")) == NULL) { printf("File open erro 阅读全文
posted @ 2021-09-27 14:00 就是想学习 阅读(69) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <string.h> #include <stdlib.h> struct sysuser{ char username[20]; char password[8]; }; void encrypt_(char *pwd); int main( 阅读全文
posted @ 2021-09-27 11:21 就是想学习 阅读(55) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <math.h> int prime(int n); int main(void){ int n = 2, count = 0; FILE * fp; if ((fp = fopen("prime.txt 阅读全文
posted @ 2021-09-27 10:46 就是想学习 阅读(70) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> struct stud_node{ int num; char name[20]; int score; struct stud_node *next; }; struct stud 阅读全文
posted @ 2021-09-25 21:14 就是想学习 阅读(135) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> struct card{ int suit; int face; }; void deal(struct card *wdeck){ int i , m, t; static int t 阅读全文
posted @ 2021-09-25 16:00 就是想学习 阅读(67) 评论(0) 推荐(0) 编辑
摘要:输入n(n<10)个整数,统计其中素数的个数。要求程序由两个文件组成,一个文件中编写main函数,另一个文件中编写素数判断的函数。使用文件包含的方式实现。 主函数 #include "prime.h" int main(void){ int i, n, count; scanf("%d", &n); 阅读全文
posted @ 2021-09-23 14:45 就是想学习 阅读(158) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> int max(int a[], int m, int n){ int k, u ,v; if (m ==n) { return a[m]; } k = (m+n)/2; u = max(a, m ,k); v = max(a, k+1, n); return 阅读全文
posted @ 2021-09-21 14:52 就是想学习 阅读(65) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> int gcd(int m, int n); void reverse(int num); int main(void){ int m, n; scanf("%d", &m); reverse(m); // scanf("%d%d",&m, &n); // pr 阅读全文
posted @ 2021-09-21 14:18 就是想学习 阅读(40) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #define MAXN 100 int Count = 0; void select_(int a[], int option, int value); void input_array(int a[]); void print_array(int a[]); 阅读全文
posted @ 2021-09-21 13:11 就是想学习 阅读(119) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> struct student{ int num; char name[40]; int computer, english, math; double average; }; int update_score(struct student *p, int n, 阅读全文
posted @ 2021-09-19 13:40 就是想学习 阅读(93) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> struct student{ int num; char name[40]; int computer, english, math; }; int main(void){ int i; struct student students[5] = { {1,"B 阅读全文
posted @ 2021-09-19 12:18 就是想学习 阅读(137) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> struct student{ int num; char name[40]; int computer, english, math; double average; }; int main(void){ int i, index, j ,n; struct 阅读全文
posted @ 2021-09-19 11:18 就是想学习 阅读(74) 评论(0) 推荐(0) 编辑
摘要:人的出生日期由年、月、日组成,请在例9-1中的学生信息结构中增加一个成员:出生日期,用嵌套定义的方式重新定义该结构类型 #include <stdio.h> struct birth{ int year, month, day; }; struct student{ int num; char na 阅读全文
posted @ 2021-09-19 11:01 就是想学习 阅读(183) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> struct complex_number{ int real; int imaginery; }; int main(void){ return 0; } 阅读全文
posted @ 2021-09-19 10:46 就是想学习 阅读(42) 评论(0) 推荐(0) 编辑
摘要:习题8-6 删除字符 (20分) 本题要求实现一个删除字符串中的指定字符的简单函数。 函数接口定义: void delchar( char *str, char c ); 其中char *str是传入的字符串,c是待删除的字符。函数delchar的功能是将字符串str中出现的所有c字符删除。 题目就 阅读全文
posted @ 2021-09-15 23:54 就是想学习 阅读(440) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> void splitfloat(float x, int *intpart, float *fracpart){ *intpart = (int) x; *fracpart = x - *intpart; } int main(void){ float numb 阅读全文
posted @ 2021-09-15 16:19 就是想学习 阅读(907) 评论(0) 推荐(0) 编辑
摘要:输入一个字符串,把该字符串的前三个字母移到最后,输出变换后的字符串。比如输入"abcdef",输出为"defabc" #include <stdio.h> #include <string.h> #define MAXN 100 int main(void){ int i, length; char 阅读全文
posted @ 2021-09-15 11:14 就是想学习 阅读(123) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #define MAXN 10 void swap(int *px, int *py); void bubble(int a[], int n); int main(void){ int n, a[MAXN]; int i; printf("Enter n(n< 阅读全文
posted @ 2021-09-14 22:54 就是想学习 阅读(49) 评论(0) 推荐(0) 编辑
摘要:最近一直在学习C语言,大学的时候没好好学,想不到10多年之后,我又开始学起来了,话说C语言确实相当有意思,至少比Python有意思。 我就写一下C语言内置的scanf函数。我的理解这是一个格式化输入的函数,用于读取信息并将信息写入指定的地址内。 常规的用法 #include <stdio.h> in 阅读全文
posted @ 2021-09-14 15:55 就是想学习 阅读(890) 评论(0) 推荐(0) 编辑
摘要:本题目要求编写程序,输入一行字符,统计每个单词的长度。所谓“单词”是指连续不含空格的字符串,各单词之间用空格分隔,空格数可以是多个。 #include <stdio.h> int main(void){ int num, space, is_print = 0,all_space=1; char c 阅读全文
posted @ 2021-09-11 16:45 就是想学习 阅读(2040) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> void hollowPyramid ( int n ); int main() { int n; scanf("%d", &n); hollowPyramid ( n ); return 0; } /* 你的代码将被嵌在这里 */ /* */ void hol 阅读全文
posted @ 2021-09-09 16:16 就是想学习 阅读(724) 评论(0) 推荐(0) 编辑
摘要:习题4-9 打印菱形图案 (15 分) 本题要求编写程序,打印一个高度为n的、由“*”组成的正菱形图案。 输入格式: 输入在一行中给出一个正的奇数n。 输出格式: 输出由n行星号“*”组成的菱形,如样例所示。每个星号后跟一个空格。 #include <stdio.h> #include <math. 阅读全文
posted @ 2021-09-07 21:27 就是想学习 阅读(75) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示