} 4.3.
}
for(i=0;i<2;i++){ }
printf(\排序\姓名\平均分\最高分\最低分\for(i=0;i<3;i++){ }
printf(\printf(\printf(\printf(\printf(\for(j=i+1;j<3;j++){ }
if(avg[i]
float_temp=avg[i]; avg[i]=avg[j]; avg[j]=float_temp; strcpy(str_temp,name[i]); strcpy(name[i],name[j]); strcpy(name[j],str_temp);
int_temp=max[i]; max[i]=max[j]; max[j]=int_temp; int_temp=min[i]; min[i]=min[j]; min[j]=int_temp;
学号对2取余,为0的完成A题,为1的完成B题
A: 从键盘上输入一个字符串(不能长于30),要求按照字符','分隔将其拆分成数组,并按照字符','出现的顺序倒序输出每个数组的第一个元素。
示例如输入字符串\则每个数组的第一个元素分别为'a','d','1','f','1',倒序则输出字符串\
#include \#include \#include \main() {
int i,k,p,j=0;
/* }
char str1[30]; char items[10][30]; int count=0;
printf(\gets(str1); i=0;
while(str1[i]!='\\0'){ }*/ k=0; p=0;
for(j=0;j items[k][p]='\\0'; for(i=count;i>=0;i--) printf(\printf(\ B:从键盘上输入两个字符串(长度不大于20)和整数n(0 输入的整数为8,则表示将fine插在ok前面(y前面为位置0,o前面的位置为8),输出为you are fine and ok. if(str1[j]!=','){ } else{ } items[k][p]='\\0'; k++; p=0; count++; items[k][p]=str1[j]; p++; if(str1[i]==',') i++; count++; #include \#include \#include \main() { char chs[20]; char chs1[20]; } 5. 6. 6.1. char temp1[20]; char temp2[20]; int n; int i,j; gets(chs); gets(chs1); scanf(\ for(i=0;i temp1[i]='\\0'; for(i=n;i temp2[i-n]=chs[i]; temp2[i-n]='\\0'; printf(\ temp1[i]=chs[i]; 第五次 第六次 编写函数用冒泡排序法将二维数组a[3][3]中的9个整数分别按照所属各行进行由大到小的排序。 #include int x, y, a[3][3]; printf(\请为数组a[3][3]输入9个数字,按回车键结束\\n\for(x=0;x<3;x++) { for(y=0;y<3;y++) { } scanf(\ int i, j, t, m; for(m=0;m<3;m++) { } for(i=0;i<2;i++) { } for(j=1;j<3-i;j++) { } if(a[m][j-1] {t=a[m][j-1]; a[m][j-1]=a[m][j]; a[m][j]=t;} } 6.2. } order(a); printf(\所求数组为:\\n\for(x=0;x<3;x++) { } 编写函数求输入的x和y之间偶数的和。 for(y=0;y<3;y++) printf(\printf(\ #include int s2(int m, int n) { } main() { } 6.3. 编写函数求方程ax2+bx+c=0的所有解(包括实根和非实根)。提示:要考虑a=0,b2-4ac>0、=0、<0等多种情况,要求针对每种情况都要提供对应函数来实现。 #include int x, y, t, E; printf(\请输入两个数字,按回车键结束\\n\scanf(\if(x>y) {t=x; x=y; y=t;} if((x%2==1)||(x%2==-1)) E=s1(x,y); E=s2(x,y); if(x%2==0) printf(\这两个数字之间的所有偶数之和为: \printf(\int i, num=0; for(i=2;i num+=m+i; int i, num=0; for(i=1;i num+=m+i; return (num); return (num); float s11 (float b, float c) { } float s12 (float a, float b, float c) { } float s21 (float a, float b, float c) { } float s22 (float a, float b, float c) { } main() { } float a, b, c, r; printf(\请输入方程ax*x+bx+c=0的3个参数a,b,c,按回车键结束\\n\scanf(\r=b*b-4*a*c; if(fabs(a)<=1e-6) s11(b,c); s12(a,b,c); s21(a,b,c); s22(a,b,c); else if(fabs(r)<=1e-6) else if(r>1e-6) else if(r<-1e-6) else printf(\float x1, x2, m, n; m=-b/(2*a); n=sqrt(4*a*c-b*b)/(2*a); printf(\方程一个虚根为: %.3f-%.3fi\\n\printf(\方程另一个虚根为: %.3f+%.3fi\\n\float x1, x2; x1=(-b-sqrt(b*b-4*a*c))/(2*a); x2=(-b+sqrt(b*b-4*a*c))/(2*a); printf(\方程一个实根为: %.3f\\n\printf(\方程另一个实根为: %.3f\\n\float x; x=-b/(2*a); printf(\方程有一个根为: %.3f\\n\float x; x=-c/b; printf(\方程有一个根为: %.3f\\n\