欢迎来到天天文库
浏览记录
ID:37909325
大小:72.00 KB
页数:16页
时间:2019-06-02
《C++程序设计综合练习题-读程序写结果题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
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、>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、"<voidprint(intw){inti;if(w!=0){print(w-1);for(i=1;i<=w;i++)cout<#definesw(x,y){x^=y;y^=x;x^=y;}voidmai4、n(){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;break;case2:c+=x;break;}}cout<5、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<<"nNumberisequalto:"<6、alto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain7、(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<<8、endl;cout<<*pArray<inti=4;voidmain(){cout<<"i="<
2、>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、"<voidprint(intw){inti;if(w!=0){print(w-1);for(i=1;i<=w;i++)cout<#definesw(x,y){x^=y;y^=x;x^=y;}voidmai4、n(){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;break;case2:c+=x;break;}}cout<5、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<<"nNumberisequalto:"<6、alto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain7、(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<<8、endl;cout<<*pArray<inti=4;voidmain(){cout<<"i="<
3、"<voidprint(intw){inti;if(w!=0){print(w-1);for(i=1;i<=w;i++)cout<#definesw(x,y){x^=y;y^=x;x^=y;}voidmai
4、n(){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;break;case2:c+=x;break;}}cout<5、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<<"nNumberisequalto:"<6、alto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain7、(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<<8、endl;cout<<*pArray<inti=4;voidmain(){cout<<"i="<
5、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<<"nNumberisequalto:"<6、alto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain7、(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<<8、endl;cout<<*pArray<inti=4;voidmain(){cout<<"i="<
6、alto:"<int*pPointer;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain
7、(){intnMyNumber=18;cout<<"Myoriginalnumberis"<voidmain(){intArray[3];Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<<
8、endl;cout<<*pArray<inti=4;voidmain(){cout<<"i="<
此文档下载收益归作者所有