欢迎来到天天文库
浏览记录
ID:21296360
大小:75.50 KB
页数:14页
时间:2018-10-21
《《高级语言程序设计c++》平时作业》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、一、分析程序,写输出结果1.#include#includevoidmain(){intm,k,i;for(m=1;m<=10;m+=2){k=m/3;for(i=2;i<=k;i++)if(m%i)cout<voidfun();voidmain(){inti;for(i=1;i<5;i++)fun();cout<2、ncludeintfun(intn){if(n==0)return1;return2*fun(n-1);}voidmain(){inta=5;cout<voidmain(){char*cp="word";for(inti=0;i<4;i++)cout<voidmain(){intma3、x;inta[10]={76,55,95,87,85,83,65,90,77,85};int*p=a;max=*p;for(;p<&a[10];p++)if(*p>max)max=*p;cout<<"max="<voidmain(){intn,k=1,s=0,m;for(n=1;n<=100;n++){k=1;s=0;1m=n;while(2m){k*=m%14、0;s+=m%10;3m/=10;}if(k>s)cout<voidmain(){doubles;inti,n;cout<<"n=";cin>>n;s=0;for(i=1;i5、;create(node*head){node*p,*q;p=newnode;cin>>p->data;q=p;while(p->data){if(head==NULL)head=p;elseq->next=p;;q=p;p=newnode;;cin>>p->data;}q->next=NULL;deletep;}}5.以下程序求方程的全部整数解:3x+2y-7z=5(0≤x,y,z≤100)#includevoidmain(){intx,y,z;for(x=0;x<=100;x++)for(y=0;y<=100;y++){6、if((z=3*x+2*y-5)%7)break;z=3*x+2*y-5)/7;//求出z的值if(z<=100&&z>=0)//检查z的范围cout<<"x="<voidmain(){inti,n;for(i=0;i<5;i++){for(n=0;n<2*i-1;n++){cout<7、两个正整数啊a和b(ausingnamespacestd;voidprintFactor(inti);voidmain(){intnumA,numB;cout<<"InputTwoNumbers:"<>numA>>numB;for(inti=numA;i<=num8、B;i++){printFactor(i);}}voidprintFactor(inti){cout<<"FACTORSO
2、ncludeintfun(intn){if(n==0)return1;return2*fun(n-1);}voidmain(){inta=5;cout<voidmain(){char*cp="word";for(inti=0;i<4;i++)cout<voidmain(){intma
3、x;inta[10]={76,55,95,87,85,83,65,90,77,85};int*p=a;max=*p;for(;p<&a[10];p++)if(*p>max)max=*p;cout<<"max="<voidmain(){intn,k=1,s=0,m;for(n=1;n<=100;n++){k=1;s=0;1m=n;while(2m){k*=m%1
4、0;s+=m%10;3m/=10;}if(k>s)cout<voidmain(){doubles;inti,n;cout<<"n=";cin>>n;s=0;for(i=1;i5、;create(node*head){node*p,*q;p=newnode;cin>>p->data;q=p;while(p->data){if(head==NULL)head=p;elseq->next=p;;q=p;p=newnode;;cin>>p->data;}q->next=NULL;deletep;}}5.以下程序求方程的全部整数解:3x+2y-7z=5(0≤x,y,z≤100)#includevoidmain(){intx,y,z;for(x=0;x<=100;x++)for(y=0;y<=100;y++){6、if((z=3*x+2*y-5)%7)break;z=3*x+2*y-5)/7;//求出z的值if(z<=100&&z>=0)//检查z的范围cout<<"x="<voidmain(){inti,n;for(i=0;i<5;i++){for(n=0;n<2*i-1;n++){cout<7、两个正整数啊a和b(ausingnamespacestd;voidprintFactor(inti);voidmain(){intnumA,numB;cout<<"InputTwoNumbers:"<>numA>>numB;for(inti=numA;i<=num8、B;i++){printFactor(i);}}voidprintFactor(inti){cout<<"FACTORSO
5、;create(node*head){node*p,*q;p=newnode;cin>>p->data;q=p;while(p->data){if(head==NULL)head=p;elseq->next=p;;q=p;p=newnode;;cin>>p->data;}q->next=NULL;deletep;}}5.以下程序求方程的全部整数解:3x+2y-7z=5(0≤x,y,z≤100)#includevoidmain(){intx,y,z;for(x=0;x<=100;x++)for(y=0;y<=100;y++){
6、if((z=3*x+2*y-5)%7)break;z=3*x+2*y-5)/7;//求出z的值if(z<=100&&z>=0)//检查z的范围cout<<"x="<voidmain(){inti,n;for(i=0;i<5;i++){for(n=0;n<2*i-1;n++){cout<7、两个正整数啊a和b(ausingnamespacestd;voidprintFactor(inti);voidmain(){intnumA,numB;cout<<"InputTwoNumbers:"<>numA>>numB;for(inti=numA;i<=num8、B;i++){printFactor(i);}}voidprintFactor(inti){cout<<"FACTORSO
7、两个正整数啊a和b(ausingnamespacestd;voidprintFactor(inti);voidmain(){intnumA,numB;cout<<"InputTwoNumbers:"<>numA>>numB;for(inti=numA;i<=num
8、B;i++){printFactor(i);}}voidprintFactor(inti){cout<<"FACTORSO
此文档下载收益归作者所有