达标篇3146.ppt
《达标篇3146.ppt》由会员分享,可在线阅读,更多相关《达标篇3146.ppt(153页珍藏版)》请在三一办公上搜索。
1、第31套程序填空,#include double fun(int n)int i,k;double s,t;s=0;/*found*/k=_1_;for(i=1;i0):);scanf(%d,#include double fun(int n)int i,k;double s,t;s=0;/*found*/k=1;for(i=1;i0):);scanf(%d,第31套程序改错,#include#include#include int fun(int m)int k=2;while(k=m,#include#include#include int fun(int m)int k=2;while(
2、k=m,第31套设计题,#include#include#includevoid fun(int a,int n,int*max,int*d)void main()FILE*wf;int i,x20,max,index,n=10;int y20=4,2,6,8,11,5;srand(unsigned)time(NULL);for(i=0;in;i+)xi=rand()%50;printf(%4d,xi);/*输出一个随机数组*/,printf(n);fun(x,n,/*/,#include#include#includevoid fun(int a,int n,int*max,int*d)in
3、t i;*max=a0;*d=0;for(i=0;in;i+)/*将最大的元素放入指针max所指的单元,最大元素的下标放入指针d所指的单元*/if(*maxai)*max=ai;*d=i;void main()FILE*wf;int i,x20,max,index,n=10;int y20=4,2,6,8,11,5;srand(unsigned)time(NULL);,for(i=0;in;i+)xi=rand()%50;printf(%4d,xi);/*输出一个随机数组*/printf(n);fun(x,n,/*/,第32套程序填空,#include double fun(double e)
4、int i;double s,x;/*found*/s=0;i=_1_;x=1.0;while(xe)/*found*/_2_;/*found*/x=(2.0*i-1)/(_3_)*(2.0*i);s=s+x;return s;main()double e=1e-3;printf(nThe result is:%fn,fun(e);,#include double fun(double e)int i;double s,x;/*found*/s=0;i=0;x=1.0;while(xe)/*found*/i+;/*found*/x=(2.0*i-1)/(2.0*i)*(2.0*i);s=s+x
5、;return s;main()double e=1e-3;printf(nThe result is:%fn,fun(e);,第32套改错题,#include#include/*found*/void fun(char s,char t)int i,d;d=strlen(s);for(i=0;id;i+)ti=si;for(i=0;id;i+)td+i=sd-1-i;/*found*/t2*d-1=0;main()char s100,t100;printf(nPlease enter string S:);scanf(%s,s);fun(s,t);printf(nThe result is:
6、%sn,t);,#include#include/*found*/void fun(char*s,char*t)int i,d;d=strlen(s);for(i=0;id;i+)ti=si;for(i=0;id;i+)td+i=sd-1-i;/*found*/t2*d=0;main()char s100,t100;printf(nPlease enter string S:);scanf(%s,s);fun(s,t);printf(nThe result is:%sn,t);,第32套程序设计题,#include#include void fun(char*s,char t)main()ch
7、ar s100,t100;void NONO();printf(nPlease enter string S:);scanf(%s,s);fun(s,t);printf(nThe result is:%sn,t);NONO();,void NONO()/*本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。*/char s100,t100;FILE*rf,*wf;int i;rf=fopen(in.dat,r);wf=fopen(out.dat,w);for(i=0;i 10;i+)fscanf(rf,%s,s);fun(s,t);fprintf(wf,%sn,t);fclose(rf
8、);fclose(wf);,#include#include void fun(char*s,char t)int i,j=0,n;n=strlen(s);for(i=0;in;i+)if(i%2!=0,scanf(%s,s);fun(s,t);printf(nThe result is:%sn,t);NONO();void NONO()/*本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。*/char s100,t100;FILE*rf,*wf;int i;rf=fopen(in.dat,r);wf=fopen(out.dat,w);for(i=0;i 10;i+)fscanf(r
9、f,%s,s);fun(s,t);fprintf(wf,%sn,t);fclose(rf);fclose(wf);,第33套程序填空,#include void fun(char*s)int i,j,n;for(i=0;si!=0;i+)/*found*/if(si=0 _1_ sii;j-)/*found*/sj+1=_3_;sj+1=*;i=i+1;main()char s80=def35adh3kjsdf7;printf(nThe original string is:%sn,s);fun(s);printf(nThe result is:%sn,s);,#include void fu
10、n(char*s)int i,j,n;for(i=0;si!=0;i+)/*found*/if(si=0,第33套改错题,#include double fun(int m)double y=1.0;int i;/*found*/for(i=2;i m;i+)/*found*/y+=1/(i*i);return(y);main()int n=5;printf(nThe result is%lfn,fun(n);,#include double fun(int m)double y=1.0;int i;/*found*/for(i=2;i=m;i+)/*found*/y+=1.0/(i*i);r
11、eturn(y);main()int n=5;printf(nThe result is%lfn,fun(n);,第33套设计题,#include void fun(int a33,int b33)main()/*主程序*/int a33=1,2,3,4,5,6,7,8,9,t33;int i,j;void NONO();fun(a,t);for(i=0;i 3;i+)for(j=0;j 3;j+)printf(%7d,tij);printf(n);NONO();,void NONO()/*本函数用于打开文件,输入测试数据,调用fun函数,输出数据,关闭文件。*/int i,j,k,a33,t
12、33;FILE*rf,*wf;rf=fopen(in.dat,r);wf=fopen(out.dat,w);for(k=0;k 5;k+)for(i=0;i 3;i+)fscanf(rf,%d%d%d,#include void fun(int a33,int b33)int i,j;for(i=0;i3;i+)for(j=0;j3;j+)bij=aij+aji;main()/*主程序*/int a33=1,2,3,4,5,6,7,8,9,t33;int i,j;void NONO();fun(a,t);for(i=0;i 3;i+)for(j=0;j 3;j+)printf(%7d,tij)
13、;printf(n);NONO();,void NONO()/*本函数用于打开文件,输入测试数据,调用fun函数,输出数据,关闭文件。*/int i,j,k,a33,t33;FILE*rf,*wf;rf=fopen(in.dat,r);wf=fopen(out.dat,w);for(k=0;k 5;k+)for(i=0;i 3;i+)fscanf(rf,%d%d%d,第34套程序填空,#include#include#define N 5typedef struct node int data;struct node*next;NODE;/*found*/_1_*fun(NODE*h)NODE
14、*p,*q,*r;p=h;if(p=NULL)return NULL;q=p-next;p-next=NULL;,while(q)/*found*/r=q-_2_;q-next=p;p=q;/*found*/q=_3_;return p;,NODE*creatlist(int a)NODE*h,*p,*q;int i;h=NULL;for(i=0;idata=ai;q-next=NULL;if(h=NULL)h=p=q;else p-next=q;p=q;return h;,void outlist(NODE*h)NODE*p;p=h;if(p=NULL)printf(The list is
15、NULL!n);else printf(nHead);do printf(-%d,p-data);p=p-next;while(p!=NULL);printf(-Endn);main()NODE*head;int aN=2,4,6,8,10;head=creatlist(a);printf(nThe original list:n);outlist(head);head=fun(head);printf(nThe list after inverting:n);outlist(head);,#include#include#define N 5typedef struct node int d
16、ata;struct node*next;NODE;/*found*/NODE*fun(NODE*h)NODE*p,*q,*r;p=h;if(p=NULL)return NULL;q=p-next;p-next=NULL;,while(q)/*found*/r=q-next;q-next=p;p=q;/*found*/q=r;return p;,NODE*creatlist(int a)NODE*h,*p,*q;int i;h=NULL;for(i=0;idata=ai;q-next=NULL;if(h=NULL)h=p=q;else p-next=q;p=q;return h;,void o
17、utlist(NODE*h)NODE*p;p=h;if(p=NULL)printf(The list is NULL!n);else printf(nHead);do printf(-%d,p-data);p=p-next;while(p!=NULL);printf(-Endn);main()NODE*head;int aN=2,4,6,8,10;head=creatlist(a);printf(nThe original list:n);outlist(head);head=fun(head);printf(nThe list after inverting:n);outlist(head)
18、;,第34套改错题,#include#include#include#include#define N 80void fun(char*s,char t)int i,j=0;for(i=0;i(int)strlen(s);i+)/*found*/if(i%2,#include#include#include#include#define N 80void fun(char*s,char t)int i,j=0;for(i=0;i(int)strlen(s);i+)/*found*/if(i%2!=0|si%2=0)tj+=si;/*found*/tj=0;void main()char sN,
19、tN;system(CLS);printf(nPlease enter string s:);gets(s);fun(s,t);printf(nThe result is:%sn,t);,第34套程序设计题,#include void fun(int(*s)10,int*b,int*n,int mm,int nn)void main()int w1010=33,33,33,33,44,44,44,44,55,55,55,55,i,j;int a100=0,n=0;FILE*out;printf(The matrix:n);for(i=0;i3;i+)for(j=0;j4;j+)printf(%
20、3d,wij);printf(n);,fun(w,a,/*/,#include void fun(int(*s)10,int*b,int*n,int mm,int nn)int i,j;for(j=0;jnn;j+)/*将二位数组中的数据按列的顺序依次放入一位数组中*/for(i=0;imm;i+)b*n=*(*(s+i)+j);*n=*n+1;/*通过指针返回元素个数*/void main()int w1010=33,33,33,33,44,44,44,44,55,55,55,55,i,j;int a100=0,n=0;FILE*out;printf(The matrix:n);,for(i
21、=0;i3;i+)for(j=0;j4;j+)printf(%3d,wij);printf(n);fun(w,a,/*/,第35套程序填空,#include#include struct student long sno;char name10;float score3;/*found*/_1_ fun(struct student a)int i;a.sno=10002;/*found*/strcpy(_2_,LiSi);/*found*/for(i=0;i3;i+)_3_+=1;return a;,main()struct student s=10001,ZhangSan,95,80,88
22、,t;int i;printf(nnThe original data:n);printf(nNo:%ld Name:%snScores:,s.sno,s.name);for(i=0;i3;i+)printf(%6.2f,s.scorei);printf(n);t=fun(s);printf(nThe data after modified:n);printf(nNo:%ld Name:%snScores:,t.sno,t.name);for(i=0;i3;i+)printf(%6.2f,t.scorei);printf(n);,#include#include struct student
23、long sno;char name10;float score3;/*found*/struct student fun(struct student a)int i;a.sno=10002;/*found*/strcpy(a.name,LiSi);/*found*/for(i=0;i3;i+)a.scorei+=1;return a;,main()struct student s=10001,ZhangSan,95,80,88,t;int i;printf(nnThe original data:n);printf(nNo:%ld Name:%snScores:,s.sno,s.name)
24、;for(i=0;i3;i+)printf(%6.2f,s.scorei);printf(n);t=fun(s);printf(nThe data after modified:n);printf(nNo:%ld Name:%snScores:,t.sno,t.name);for(i=0;i3;i+)printf(%6.2f,t.scorei);printf(n);,第35套程序改错题,#include#define N 20int fun(int*a,int n,int x)int p=0,i;an=x;while(x!=ap)p=p+1;/*found*/if(P=n)return-1;e
25、lse for(i=p;in-1;i+)/*found*/ai+1=ai;return n-1;,main()int wN=-3,0,1,5,7,99,10,15,30,90,x,n,i;n=10;printf(The original data:n);for(i=0;in;i+)printf(%5d,wi);printf(nInput x(to delete):);scanf(%d,#include#define N 20int fun(int*a,int n,int x)int p=0,i;an=x;while(x!=ap)p=p+1;/*found*/if(p=n)return-1;el
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 达标 3146
![提示](https://www.31ppt.com/images/bang_tan.gif)
链接地址:https://www.31ppt.com/p-5850575.html