欢迎来到天天文库
浏览记录
ID:59278758
大小:70.00 KB
页数:16页
时间:2020-09-07
《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<voidswapl(
2、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)a..{inttemp=a;a=b;b=temp;}voidmain(){inta=10,b=20;swapl(a,b);cout<3、b);cout<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;}voidmain(){inta=10,b=01;sw(a,b);cout<4、","<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<voidmain(){i5、ntj,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:"<int*pPoin6、ter;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain(){intnMyNumber=18;cout<<"Myoriginalnumberis"<7、ive(&nMyNumber);cout<<"Mynewnumberis"<voidmain(){intArray[3];a..Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<in8、ti=4;voidmain(){cout<<"i="<
3、b);cout<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;}voidmain(){inta=10,b=01;sw(a,b);cout<4、","<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<voidmain(){i5、ntj,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:"<int*pPoin6、ter;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain(){intnMyNumber=18;cout<<"Myoriginalnumberis"<7、ive(&nMyNumber);cout<<"Mynewnumberis"<voidmain(){intArray[3];a..Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<in8、ti=4;voidmain(){cout<<"i="<
4、","<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<voidmain(){i
5、ntj,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:"<int*pPoin
6、ter;voidSomeFunction(){pPointer=newint;*pPointer=25;}voidmain(){SomeFunction();cout<<"Valueof*pPointer:"<<*pPointer<voidAddFive(int*Number){*Number=*Number+5;}voidmain(){intnMyNumber=18;cout<<"Myoriginalnumberis"<7、ive(&nMyNumber);cout<<"Mynewnumberis"<voidmain(){intArray[3];a..Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<in8、ti=4;voidmain(){cout<<"i="<
7、ive(&nMyNumber);cout<<"Mynewnumberis"<voidmain(){intArray[3];a..Array[0]=10;Array[1]=20;Array[2]=30;int*pArray;pArray=&Array[0];cout<<"pArraypointstothevalue."<in
8、ti=4;voidmain(){cout<<"i="<
此文档下载收益归作者所有