欢迎来到天天文库
浏览记录
ID:10910266
大小:268.50 KB
页数:48页
时间:2018-07-08
《c++程序设计实验(上)试题及答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、C++程序设计实验(上)试卷库题型1——基本型(顺序、选择)1、输入一个华氏温度的值F,要求输出其摄氏温度值C,公式为【解答】#includeusingnamespacestd;intmain(){floatC,Fcin>>F;C=5.0/9.0*(F-32.0);cout<<"C="<usingnamespacestd;intmain(){inta,b,c,maxcin>>a>>b>>c;max=a
2、;if(b>max)max=b;if(c>max)max=c;cout<<"max="<usingnamespacestd;intmain(){inta,b,c,maxcin>>a>>b>>c;if(b>a)max=b;elsemax=a;if(c>max)max=c;cout<<"max="<usingnamespacestd;intmain(){inta,b,c,maxcin>>
3、a>>b>>c;if(b>=a&&b>=c)max=b;elseif(c>=a)max=c;elsemax=a;cout<<"max="<usingnamespacestd;intmain(){charchcin>>ch;if(ch>=’A’&&ch<=’Z’)ch=ch+’a’-’A’;cout<<"ch="<4、其转换为大写字母,其它字符则原样输出。【解答】#includeusingnamespacestd;intmain(){charchcin>>ch;if(ch>=’a’&&ch<=’z’)ch=ch-(’a’-’A’);cout<<"ch="<usingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;min=a;if(b5、in)max=c;cout<<"min="<usingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;if(busingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;if(b<=a&&b<=c)6、min=b;elseif(c<=a)min=c;elsemin=a;cout<<"min="<usingnamespacestd;intmain(){floatC,Fcin>>C;F=9.0/5.0*C+32.0;cout<<"F="<usingnamespacestd;intmain(){f7、loatx,ycin>>x;if(x<1)y=x;elseif(x<10)y=2*x-1;elsey=3*x-11;cout<<"y="<#includeusingnamespacestd;intmain(){floatx,ycin>>x;if(x<0)y=sin(x);elseif(x<5)y=2*x+1;elsey=x-10;cout<<"y="<8、,编程求两点之间的距离。公式为【解答】#include#include
4、其转换为大写字母,其它字符则原样输出。【解答】#includeusingnamespacestd;intmain(){charchcin>>ch;if(ch>=’a’&&ch<=’z’)ch=ch-(’a’-’A’);cout<<"ch="<usingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;min=a;if(b5、in)max=c;cout<<"min="<usingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;if(busingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;if(b<=a&&b<=c)6、min=b;elseif(c<=a)min=c;elsemin=a;cout<<"min="<usingnamespacestd;intmain(){floatC,Fcin>>C;F=9.0/5.0*C+32.0;cout<<"F="<usingnamespacestd;intmain(){f7、loatx,ycin>>x;if(x<1)y=x;elseif(x<10)y=2*x-1;elsey=3*x-11;cout<<"y="<#includeusingnamespacestd;intmain(){floatx,ycin>>x;if(x<0)y=sin(x);elseif(x<5)y=2*x+1;elsey=x-10;cout<<"y="<8、,编程求两点之间的距离。公式为【解答】#include#include
5、in)max=c;cout<<"min="<usingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;if(busingnamespacestd;intmain(){inta,b,c,mincin>>a>>b>>c;if(b<=a&&b<=c)
6、min=b;elseif(c<=a)min=c;elsemin=a;cout<<"min="<usingnamespacestd;intmain(){floatC,Fcin>>C;F=9.0/5.0*C+32.0;cout<<"F="<usingnamespacestd;intmain(){f
7、loatx,ycin>>x;if(x<1)y=x;elseif(x<10)y=2*x-1;elsey=3*x-11;cout<<"y="<#includeusingnamespacestd;intmain(){floatx,ycin>>x;if(x<0)y=sin(x);elseif(x<5)y=2*x+1;elsey=x-10;cout<<"y="<8、,编程求两点之间的距离。公式为【解答】#include#include
8、,编程求两点之间的距离。公式为【解答】#include#include
此文档下载收益归作者所有