欢迎来到天天文库
浏览记录
ID:38780232
大小:33.32 KB
页数:17页
时间:2019-06-19
《中国石油大学(华东)c++上机作业》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、C++上机作业第二章2.25#includeusingnamespacestd;intmain(){inta,b;int&m=a,&n=b;cin>>a>>b;if(m>n)cout<<"Theresultis"<m)cout<<"Theresultis"<usingnamespacest
2、d;intmain(){int*a=newint[21];int*b=newint(3);a[1]=a[2]=1;cout<#includeusingnamespacestd;doublesroot(in
3、ta){return(double)sqrt((float)a);}doublesroot(longintb){return(double)sqrt((longdouble)b);}doublesroot(doublec){return(double)sqrt(c);}intmain(){inta;longintb;doublec;cin>>a>>b>>c;cout<usingna
4、mespacestd;intmain(){inti,j,l,sum=0;for(i=0;i<101;i++)for(j=0;j<51;j++)for(l=0;l<21;l++){if(i+2*j+5*l==100)sum++;}cout<<"Sumis"<usingnamespacestd;inlineintf(intx);intmain(){inta,b,c;cin>>a>>b;if(f(a)==0)cout<<"Rootis:"<5、dl;elseif(f(b)==0)cout<<"Rootis:"<usingnamespacestd;classcounter{public:cou6、nter(intnumber);//构造函数voidincrement();//给原值加1voiddecrement();///给原值减1intgetvalue();//取得计数器值intprint();//显示计数private:intvalue;};counter::counter(intnumber){value=number;}voidcounter::increment(){value=value+1;}voidcounter::decrement(){value=value-1;}intcounter::getval7、ue(){returnvalue;}intcounter::print(){returnvalue;}intmain(){inta,i;cin>>a;counterA(a);for(i=2;i<=A.getvalue()+1;i++){cout<<"valueis"<=0;i--){cout<<"valueis"<usingnamespacestd;classDate{public:voi8、dprintDate();//显示日期voidsetDay(intd);//设置日期值voidsetMonth(intm);//设置月的值voidsetYear(inty);//设置年的值private:intday,month,year;};voidDate:
5、dl;elseif(f(b)==0)cout<<"Rootis:"<usingnamespacestd;classcounter{public:cou
6、nter(intnumber);//构造函数voidincrement();//给原值加1voiddecrement();///给原值减1intgetvalue();//取得计数器值intprint();//显示计数private:intvalue;};counter::counter(intnumber){value=number;}voidcounter::increment(){value=value+1;}voidcounter::decrement(){value=value-1;}intcounter::getval
7、ue(){returnvalue;}intcounter::print(){returnvalue;}intmain(){inta,i;cin>>a;counterA(a);for(i=2;i<=A.getvalue()+1;i++){cout<<"valueis"<=0;i--){cout<<"valueis"<usingnamespacestd;classDate{public:voi
8、dprintDate();//显示日期voidsetDay(intd);//设置日期值voidsetMonth(intm);//设置月的值voidsetYear(inty);//设置年的值private:intday,month,year;};voidDate:
此文档下载收益归作者所有