欢迎来到天天文库
浏览记录
ID:17322342
大小:36.50 KB
页数:10页
时间:2018-08-30
《《c++语言程序设计》自检自测题(三)及答案》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《C++语言程序设计》自检自测题(三)及答案一、给出下列程序运行后的输出结果1.#includevoidmain(){ints1=0,s2=0;for(inti=0;i<10;i++)if(i%2)s1+=i;elses2+=i;cout<voidmain(){inta[8]={8,19,26,15,6,24,27,18};inti2=0,i3=0;for(inti=0;i<8;i++)if(a[i]%2==0)i2++;e
2、lseif(a[i]%3==0)i3++;cout<voidmain(){inta[3][4]={{1,2,7,8},{5,6,11,12},{9,20,3,4}};intm=a[0][0];intii=0,jj=0;for(inti=0;i<3;i++)for(intj=0;j<4;j++)if(a[i][j]>m){m=a[i][j];ii=i;jj=j;}cout<3、cludevoidmain(){inta=10,b=15;cout<4、ationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationscout<voidmain(){intx=20,y=40,*p;p=&x;cout<<*p<<’’;*p=x+10;p=&y;cout<<*p<5、<voidSB(charch){switch(ch){case’A’:case’a’:cout<<”well!”;break;case’B’:case’b’:cout<<”good!”;break;case’C’:case’c’:cout<<”pass!”;break;default:cout<<”bad!”;break;}cout<6、i]);}7.#includevoidmain(){inta[8]={36,25,48,14,55,40,72,40};intb1,b2;b1=b2=a[0];for(inti=1;i<8;i++)if(a[i]>b1){if(b1>b2)b2=b1;constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckouta7、ndevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationsb1=a[i];}cout<voidmain(){inta[8]={3,5,7,9,11,13,158、,17};int*p=1;for(inti=0;i<8;i++){cout<voidLG(int*&a,int&m){a=newint[
3、cludevoidmain(){inta=10,b=15;cout<4、ationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationscout<voidmain(){intx=20,y=40,*p;p=&x;cout<<*p<<’’;*p=x+10;p=&y;cout<<*p<5、<voidSB(charch){switch(ch){case’A’:case’a’:cout<<”well!”;break;case’B’:case’b’:cout<<”good!”;break;case’C’:case’c’:cout<<”pass!”;break;default:cout<<”bad!”;break;}cout<6、i]);}7.#includevoidmain(){inta[8]={36,25,48,14,55,40,72,40};intb1,b2;b1=b2=a[0];for(inti=1;i<8;i++)if(a[i]>b1){if(b1>b2)b2=b1;constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckouta7、ndevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationsb1=a[i];}cout<voidmain(){inta[8]={3,5,7,9,11,13,158、,17};int*p=1;for(inti=0;i<8;i++){cout<voidLG(int*&a,int&m){a=newint[
4、ationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationscout<voidmain(){intx=20,y=40,*p;p=&x;cout<<*p<<’’;*p=x+10;p=&y;cout<<*p<5、<voidSB(charch){switch(ch){case’A’:case’a’:cout<<”well!”;break;case’B’:case’b’:cout<<”good!”;break;case’C’:case’c’:cout<<”pass!”;break;default:cout<<”bad!”;break;}cout<6、i]);}7.#includevoidmain(){inta[8]={36,25,48,14,55,40,72,40};intb1,b2;b1=b2=a[0];for(inti=1;i<8;i++)if(a[i]>b1){if(b1>b2)b2=b1;constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckouta7、ndevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationsb1=a[i];}cout<voidmain(){inta[8]={3,5,7,9,11,13,158、,17};int*p=1;for(inti=0;i<8;i++){cout<voidLG(int*&a,int&m){a=newint[
5、<voidSB(charch){switch(ch){case’A’:case’a’:cout<<”well!”;break;case’B’:case’b’:cout<<”good!”;break;case’C’:case’c’:cout<<”pass!”;break;default:cout<<”bad!”;break;}cout<6、i]);}7.#includevoidmain(){inta[8]={36,25,48,14,55,40,72,40};intb1,b2;b1=b2=a[0];for(inti=1;i<8;i++)if(a[i]>b1){if(b1>b2)b2=b1;constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckouta7、ndevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationsb1=a[i];}cout<voidmain(){inta[8]={3,5,7,9,11,13,158、,17};int*p=1;for(inti=0;i<8;i++){cout<voidLG(int*&a,int&m){a=newint[
6、i]);}7.#includevoidmain(){inta[8]={36,25,48,14,55,40,72,40};intb1,b2;b1=b2=a[0];for(inti=1;i<8;i++)if(a[i]>b1){if(b1>b2)b2=b1;constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckouta
7、ndevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationsb1=a[i];}cout<voidmain(){inta[8]={3,5,7,9,11,13,15
8、,17};int*p=1;for(inti=0;i<8;i++){cout<voidLG(int*&a,int&m){a=newint[
此文档下载收益归作者所有