欢迎来到天天文库
浏览记录
ID:48998701
大小:52.50 KB
页数:16页
时间:2020-02-26
《C++程序设计综合练习题-读程序写结果题.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、C++程序设计模拟题三、用C++语言描述下列命题1、A小于B并且A大于C2、A和B中有—个小于C3、A是奇数4、B和C中较大者与A相等5、年份Y是闰年四、写出下列程序的执行结果1.#includevoidmain(){intb[3][5]={11,12,13,14,15,21,22,23,24,25,31,32,33,34,35};int(*p)[5];p=b;for(intj=0;j<5;j++)cout<<*(*p+j)<<",";cout<2、tream.h>voidswapl(inta,intb){inttemp=a;a=b;b=temp;}voidswap2(int*a,int*b){inttemp=*a;*a=*b,*b=temp;}voidswap3(int*a,int*b){int*temp=a;a=b,b=temp;}voidswap4(int&a,int&b)精选范本,供参考!{inttemp=a;a=b;b=temp;}voidmain(){inta=10,b=20;swapl(a,b);cout<3、wap2(&a,&b);cout<voidprint(intw){inti;if(w!=0){print(w-1);for(i=1;i<=w;i++)cout<#defines4、w(x,y){x^=y;y^=x;x^=y;}voidmain(){inta=10,b=01;sw(a,b);cout<voidmain(){inta,b,c,x;a=b=c=0;for(intk=0;k<10;k++){cin>>x;switch(x%3){case0:a+=x;break;case1:b+=x;b5、reak;case2:c+=x;break;}}cout<voidmain(){intj,k;for(j=5;j>0;j--){for(k=j;k>0;k--)cout<<"*";cout<voidmain(){intnNumber;int*pPointer;nNumber=15;pPointer=&nNumber;cout<<"nNumberisequa6、lto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<7、ncludevoidAddFive(int*Number){*Number=*Number+5;}voidmain(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];精选范本,供参考!Array[0]=10;8、Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<inti=4;voidmain(){cout<<"i="<
2、tream.h>voidswapl(inta,intb){inttemp=a;a=b;b=temp;}voidswap2(int*a,int*b){inttemp=*a;*a=*b,*b=temp;}voidswap3(int*a,int*b){int*temp=a;a=b,b=temp;}voidswap4(int&a,int&b)精选范本,供参考!{inttemp=a;a=b;b=temp;}voidmain(){inta=10,b=20;swapl(a,b);cout<3、wap2(&a,&b);cout<voidprint(intw){inti;if(w!=0){print(w-1);for(i=1;i<=w;i++)cout<#defines4、w(x,y){x^=y;y^=x;x^=y;}voidmain(){inta=10,b=01;sw(a,b);cout<voidmain(){inta,b,c,x;a=b=c=0;for(intk=0;k<10;k++){cin>>x;switch(x%3){case0:a+=x;break;case1:b+=x;b5、reak;case2:c+=x;break;}}cout<voidmain(){intj,k;for(j=5;j>0;j--){for(k=j;k>0;k--)cout<<"*";cout<voidmain(){intnNumber;int*pPointer;nNumber=15;pPointer=&nNumber;cout<<"nNumberisequa6、lto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<7、ncludevoidAddFive(int*Number){*Number=*Number+5;}voidmain(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];精选范本,供参考!Array[0]=10;8、Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<inti=4;voidmain(){cout<<"i="<
3、wap2(&a,&b);cout<voidprint(intw){inti;if(w!=0){print(w-1);for(i=1;i<=w;i++)cout<#defines
4、w(x,y){x^=y;y^=x;x^=y;}voidmain(){inta=10,b=01;sw(a,b);cout<voidmain(){inta,b,c,x;a=b=c=0;for(intk=0;k<10;k++){cin>>x;switch(x%3){case0:a+=x;break;case1:b+=x;b
5、reak;case2:c+=x;break;}}cout<voidmain(){intj,k;for(j=5;j>0;j--){for(k=j;k>0;k--)cout<<"*";cout<voidmain(){intnNumber;int*pPointer;nNumber=15;pPointer=&nNumber;cout<<"nNumberisequa
6、lto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<7、ncludevoidAddFive(int*Number){*Number=*Number+5;}voidmain(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];精选范本,供参考!Array[0]=10;8、Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<inti=4;voidmain(){cout<<"i="<
7、ncludevoidAddFive(int*Number){*Number=*Number+5;}voidmain(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];精选范本,供参考!Array[0]=10;
8、Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<inti=4;voidmain(){cout<<"i="<
此文档下载收益归作者所有