




已阅读5页,还剩43页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#if 0 /8.1#include#includevoid main() int Common_divisor(int a,int b); int Common_mutiple(int m,int n); int result_1,result_2; int number_1,number_2; printf(Enter number_1 and number_2 value:); scanf(%d,%d,&number_1,&number_2); result_1 = Common_divisor(number_1,number_2); result_2 = Common_mutiple(number_1,number_2); printf(最大公约数:%dn最小公倍数:%dn,result_1,result_2);int Common_divisor(int a,int b) int r = 1; while(r != 0) if(ab) r = a%b; a = b; b = r; if(r = 0) return a; break; else r = b%a; b = a; if(r = 0) return b; break; a = r; int Common_mutiple(int m,int n) int Common_divisor(int a,int b);int temp = 0,result = 0; temp = Common_divisor(m,n);result = (m*n)/temp;return result;#endif#if 0 /8.2#include#includefloat result_1 =0.0,result_2 = 0.0;void main()void Funvtion_1(float a,float b,float temp); void Function_2(float a,float b); float a,b,c; float temp; printf(Enter a,b,c value:); scanf(%f,%f,%f,&a,&b,&c); temp = b*b-4*a*c; if(temp 0) Funvtion_1(a,b,temp); printf(x1 = %.3f,x2 = %.3fn,result_1,result_2); else if(temp 0) printf(此函数没有根!n); else Function_2(a,b); printf(x1 = x2 = %.3fn,result_1); void Funvtion_1(float a,float b,float temp)result_1 = (-b+temp)/(2*a);result_2 = (-b-temp)/(2*a);void Function_2(float a,float b) result_1 = (-b)/(2*a);#endif#if 0 /8.3#include#includevoid main() void Prime(int n); int m; printf(Enter m value:); scanf(%d,&m); Prime(m);void Prime(int n) int i = 0 ,k; k = (int)sqrt(n); for(i = 2; i k) printf(The number %d is a prime!n,n); else printf(The number %d isnt a prime!n,n); #endif#if 0#include#includeint c33;void main()void Function(int b33);int a33 = 1,2,3,4,5,6,7,8,9;int i,j;/int d33;int k = sizeof(a2)/sizeof(int); /列数int n = sizeof(a)/sizeof(int);for(i = 0; i n/k;i+) for(j = 0;j k;j+) printf(%d ,aij); printf(n); Function(a);for(i = 0; i k;i+) for(j = 0;j n/k;j+) printf(%d ,cij); printf(n);void Function(int b33) int i = 0,j = 0;int k = sizeof(b3)/sizeof(int);int n = sizeof(b)/sizeof(int);for(i = 0;i k ;+i) for(j = 0;j k; +j) cji = bij;#endif#if 0#include#include#includevoid main() void Function(char a100,char b100); char a100; extern int b100; int n = sizeof(a); printf(Enter a Array:); gets(a); Function(a,b);void Function(char a,char b) int i = 0; int n = sizeof(a)/sizeof(char); int m = strlen(a); for(i = 0; i m;i+) bi = am-1-i; /printf(put b Array:); /puts(b); for(i = 0;i m;i+) putchar(bi); #endif#if 0 /8.6#include#includevoid main() char a20; char b10; printf(Enter string a value:); gets(a); printf(Enter string b value:); gets(b); strcat(a,b); puts(a);#endif#if 0 /8.6#include#include#includeint a20;void main() void Connect(char a,char b); char b10; printf(Enter string a value:); gets(a); printf(Enter string b value:); gets(b); Connect(a,b);/ puts(a); printf(%s,a);void Connect(char a,char b) int i = 0; int j = 0; while(ai != 0) i+; while(bj != 0) ai+ = bj+; / ai = 0; #endif#if 0/8.7#include#include#includechar b100;void main() void Research_vowel(char a); char a50; printf(Enter string a value:); gets(a); Research_vowel(a); puts(b);void Research_vowel(char a) int i = 0,j = 0; for(; i strlen(a);i+) if(ai = a| ai = e | ai = i | ai = o | ai = u) bj = ai; j+; #endif#if 0/8.8#include#includechar a4;void main() void Divide(int n);int n = 0,i = 0;printf(Enter n value(10000):);scanf(%d,&n);Divide(n);for(;i= 1) c = n/m; b = n%m; m = m/10; ai = c; n = b; i+;#endif#if 0/8.9#include#include#includeint m = 0,n = 0,r = 0,l = 0;void main() void Research_number(char a); char a50; int i = 0; printf(enter string value:); gets(a); /*for(;istrlen(a);i+) printf(%c,ai); */ puts(a); puts(); Research_number(a); printf(字母个数是:%d,数字个数是:%d,空格个数是:%d,其它:%dn,m,n,r,l);void Research_number(char a) int i = 0;for(i = 0;i= a & ai = A & ai 47 & ai 58) n+; else if(ai = 32) r+; else l+; #endif#if 0 /8.10#include#include#includevoid main() void Array(char a); char b20; printf(Enter b string(20):); gets(b); printf(Longest word is : ); Array(b);void Array(char a) int i = 0,place = 0,point = 0,length = 1; /point表示最长单词的开始位置 place表示最长单词最后的一个位置int max = 0,j = 0;int flag = 0; /为0 时是空格 为1时是单词max = length;for(i = 0;i=strlen(a);i+) if(ai != & ai != 0) if(0 = flag) j = i; flag = 1; else length+; /这个题让我做的非常的难过 以后要好好的复习elseflag = 0;if(max length) max = length;point = j;place = i;length = 1; for(i = point;i = place;i+) printf(%c,ai);printf(n);/*int judge_words(char b20)int i = 0,flag = 1; for(i = 0;i = a & ai = A & ai = Z) flag = 1; else flag = 0; */#endif#if 0 /8.11#include#includevoid main() void bubbling(char a); char a10; printf(enter string a value:); gets(a); bubbling(a); puts(a);void bubbling(char a) int i = 0,j = 0;char temp; for(i = 0;istrlen(a) - 1;i+) for( j = 0;j aj+1) temp = aj; aj = aj+1; aj+1 = temp; #endif#if 0 /8.12#include#includevoid main() float Function(float x);float x = 1.5,x1 = 0.0; x1 = Function(x); printf(%.3fn,x1);float Function(float x) float x1; float y,y1; while(fabs(y1)=1e-6) x = x1; y1 = x*x*x+2*x*x+3*x+4; y = 3*x*x+4*x+3; x1 = x - (y1/y); return x1;#endif#if 0/8.13#include#includevoid main()float p(float x,int n); float x = 0.0,result = 0.0; int n = 0; printf(Enter x and n value:); scanf(%f,%d,&x,&n); result = p(x,n); printf(p(x) value :%.3fn,result);float p(float x,int n) float y = 0.0;if(n = 0) y = 0;else if(n = 1) y = x;else y = (2*n-1)*x-p(x,n-1)-(n-1)*p(x,n-2)/n;return y;#endif#if 0/8.14#include#includeint r = 0,l = 0;void main()float* EStudent_aver(float scores105);float* EClass_aver(float scores105);float Maxscore(float scores105);float variance(float scores105);float scores105 = 76,43,46,73,46,34,67,89,32,47,31,68,73,16,87,31,67,31,37,63,16,37,61,67,86,31,34,60,49,29,89,89,87,87,98,97,34,89,42,89,45,67,34,18,64,32,16,87,42,15;float *Student_aver,*Class_aver,Student_max = 0.0,aver_variance = 0.0; int i = 0,j = 0,k = 0;/*char Student_name = Zhanghua Xiaoming Ligang Xiaotao Zhangsan Xiaoqiang CBC Baixu Gongcheng BOBO ;char score_name = Chinese Math English Chemitry WuLi;printf(t);for(i = 0;i strlen(score_name);i+) printf(%c,score_namei);puts();for(i = 0;i strlen(Student_name);i+)printf(%c,Student_namei);if(Student_namei = 32) for(j = 0;j 5;j+) printf( %.0ft,scoreskj);k+;puts();*/*printf(n);for(i = 0; i 10;i+) for(j = 0;j 5;j+) printf( %.0ft,scoresij);puts();*/float scores105;printf(NO. course1 course2 course3 course4 course5n);for(i = 0;i 10;i+) printf(No.%2dt,i+1);for(j = 0;j 5;j+) printf(%.2ft ,scoresij);puts(); Student_aver = EStudent_aver(scores); Class_aver = EClass_aver(scores); Student_max = Maxscore(scores); aver_variance = variance(scores); printf(Student_aver:n); for(i = 0;i 10;i+) printf(%.2f ,Student_averi); printf(nClass_aver:n); for(i = 0 ;i 5;i+) printf(%.2f ,Class_averi); printf(n); printf(The Max Score:n %.2f Name: No.%d , Course: course%dn,Student_max,r,l); printf(Student average Variance: n %.2fn,aver_variance);float * EStudent_aver(float scores105) static float aver10,sum = 0.0;int i = 0,j = 0;for(i = 0;i 10;i+) for(j = 0; j 5; j+) sum += scoresij; averi = sum/5; sum = 0;return aver;float* EClass_aver(float scores105) static float aver_15,sum = 0.0; int i = 0,j = 0;for(j = 0;j5;j+) for(i = 0;i10;i+) sum +=scoresij;aver_1j = sum/10;sum = 0;return aver_1;float Maxscore(float scores105) int i = 0,j = 0;float max = scores00;for(i = 0;i 10;i+) for(j = 0;j 5;j+) if(max scoresij) max = scoresij; r = i + 1; l = j + 1;return max;float variance(float scores105)float* EStudent_aver(float scores105); float s = 0.0; float sum_1 = 0.0,sum_2 = 0.0; float number_1 = 0.0,number_2 = 0.0; float* student_aver; int i = 0,j = 0; student_aver = EStudent_aver(scores); for(i = 0;i10;i+) sum_1 += student_averi*student_averi; sum_2 += student_averi; number_1 = sum_1/10; number_2 = (sum_2/10)*(sum_2/10); s = number_1 - number_2; return s;#endif#if 0 /测试 static#include#includestatic j;void f1() static i = 0; i+;void f2() j = 0; j+;void main() int k = 0; for(k = 0;k 10;k+) f1(); f2(); #endif#if 0/8.16#include#includevoid main() void Change(int n); int m = 0; printf(Enter ox number:); scanf(%x,&m); / printf(%dn,m); Change(m);void Change(int n) /int m;printf(十进制是: %dn,n);#endif#if 0/8.17#include#includevoid main()void Function(int n); int m;printf(Input a integer:);scanf(%d,&m); Function(m);void Function(int n) int i;/* if(n!=0) chi = n%10; temp = n/10; i+; Function(temp); else chi = 0; return ch;*/ i = n/10; if(i != 0) Function(i); putchar(n%10+0); putchar(32);#endif#if 0 /今天是今年的多少天#include#includevoid main() int i = 1,d = 0,sum = 0;int year,month,day;printf(Enter year and month and day(2012/08/19):);scanf(%d/%d/%d,&year,&month,&day);sum = day;for(;imonth;i+) switch(i) case 1: case 3: case 5: case 7: case 8: case 10: case 12: d = 31; break; case 2: if(year%400 = 0 | year%4 = 0 & year%100!=0) d = 29; else d = 28; break; case 4: case 6: case 9: case 11: d = 30;break; sum += d;printf(The %d of The year dates!n,sum);#endif#if 0 /8.15#include#define N 10void main() void Enter_massage(char staff_nameN10,int staff_numberN); void Sort(char staff_nameN10,int staff_numberN);int middle_search(int staff_numberN,int number);int number,temp = 0;char staff_nameN10;int staff_numberN;Enter_massage(staff_name,staff_number);/输入信息Sort(staff_name,staff_number);printf(Enter search staff_number:);scanf(%d,&number); temp = middle_search(staff_number,number);printf(The staff number is : %dn,staff_numbertemp);printf(The staff name is : %sn,staff_nametemp);void Enter_massage(char staff_nameN10,int staff_numberN) int i; for(i = 0;i N;i+) printf(Enter Staff number No.:); scanf(%d,&staff_numberi); fflush(stdin); printf(Input staff name:); gets(staff_namei); void Sort(char staff_nameN10,int staff_numberN) int i,j; int temp1;char tempN10;for(i = 0;i N - 1; i+)for(j = 0;j staff_numberj+1) temp1 = staff_numberj; strcpy(tempj,staff_namej); staff_numberj = staff_numberj+1; strcpy(staff_namej,staff_namej+1); staff_numberj+1 = temp1; strcpy(staff_namej+1,tempj); /*if(staff_numberistaff_numberi+1) temp1 = staff_numberi; staff_numberi = staff_numberi+1; staff_numberi+1 = temp1; */for(i = 0;i N;i+) printf(staff number is : %dn,staff_numberi);printf(staff name is %sn,staff_namei); int middle_search(int staff_numberN,int number) /折半查找法! int min = 0,high = 0,mid = 0;int i = 0;min = 0;high = N - 1;while(min number) high = mid - 1; else if(staff_numbermid number) min = mid + 1; else return mid; #endif/*fasdfa the world helloint flag=0;flag=1;/letterflag=0;/space*/#if 0 /有问题 输出的是不对的! 为什么指针值temp+1的值不是指向的name1这一行的首地址 而是+后指向的是name0下一列的地址呢? #includevoid main() char name510; char temp510; int i = 0;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年海南省妇女儿童医学中心招聘84人笔试备考题库及答案详解一套
- 2025年广西壮族自治区工业促进和中小企业服务中心招聘重点领域急需紧缺高层次人才3人考试参考题库及答案解析
- 颈椎病完整课件
- 颈椎核磁共振课件
- 2025四川长虹电源股份有限公司招聘计划管理员岗位1人考试参考题库及答案解析
- 2025江苏省省级机关医院院前急救站派遣制医师招聘1人考试参考题库及答案解析
- 2025重庆家禽研究所招聘考试参考题库及答案解析
- 智能包装技术创新创业项目商业计划书
- 教育人才服务创新创业项目商业计划书
- 智能洗浴设备创新创业项目商业计划书
- 伤逝-课件完整版
- 【七年级上】书法教案
- 《水循环》-完整版课件
- 轮胎印痕分析与运用课件
- 库房温湿度记录表
- 10KV电力安全工器具试验报告
- (精选word)英语四线格(a4打印)
- 家谱模板,树形图(绝对精品,一目了然)
- 移动商务文案写作教程课件
- SP30超级数字程控交换机技术手册
- 《幼儿园早操培训》PPT课件
评论
0/150
提交评论