摘要:第四题 将文件中的数据求和并写入文本文件尾:文件Int_Data.dat中存放了若干整数,将文件中所有数据相加,并把累加和写入该文件的最后。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(void){ int n
阅读全文
摘要:3.比较两个文本文件是否相等:比较两个文本文件的内容是否相同,并输出两个文件中第一次出现不同字符内容的行号及列值。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(void){ int row, column; c
阅读全文
摘要:第一题:统计文本文件中各类字符个数:分别统计一个文本文件中字母、数字及其其它字符的个数。 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(void){ int alphabet, digit, other; cha
阅读全文
摘要:#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
阅读全文
摘要:输入n(n<10)个整数,统计其中素数的个数。要求程序由两个文件组成,一个文件中编写main函数,另一个文件中编写素数判断的函数。使用文件包含的方式实现。 主函数 #include "prime.h" int main(void){ int i, n, count; scanf("%d", &n);
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#include <stdio.h> struct student{ int num; char name[40]; int computer, english, math; double average; }; int update_score(struct student *p, int n,
阅读全文
摘要:#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
阅读全文
摘要:输入一个字符串,把该字符串的前三个字母移到最后,输出变换后的字符串。比如输入"abcdef",输出为"defabc" #include <stdio.h> #include <string.h> #define MAXN 100 int main(void){ int i, length; char
阅读全文
摘要:#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<
阅读全文
摘要:本题目要求编写程序,输入一行字符,统计每个单词的长度。所谓“单词”是指连续不含空格的字符串,各单词之间用空格分隔,空格数可以是多个。 #include <stdio.h> int main(void){ int num, space, is_print = 0,all_space=1; char c
阅读全文
摘要:#include <stdio.h> void hollowPyramid ( int n ); int main() { int n; scanf("%d", &n); hollowPyramid ( n ); return 0; } /* 你的代码将被嵌在这里 */ /* */ void hol
阅读全文