华中科技大学 刷题c++ 题目 答案

上传人:第*** 文档编号:33593727 上传时间:2018-02-16 格式:DOCX 页数:10 大小:25.85KB
返回 下载 相关 举报
华中科技大学  刷题c++  题目 答案_第1页
第1页 / 共10页
华中科技大学  刷题c++  题目 答案_第2页
第2页 / 共10页
华中科技大学  刷题c++  题目 答案_第3页
第3页 / 共10页
华中科技大学  刷题c++  题目 答案_第4页
第4页 / 共10页
华中科技大学  刷题c++  题目 答案_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《华中科技大学 刷题c++ 题目 答案》由会员分享,可在线阅读,更多相关《华中科技大学 刷题c++ 题目 答案(10页珍藏版)》请在金锄头文库上搜索。

1、电文加密的算法是:将字母 A 变成 F,a 变成 f,B 变成 G,b 变成 g,依次类推,V 变成 A,W 变成 B,等等。其他字符不变。从键盘输入一串电文,用函数将其加密,再在主函数中输出加密后的串。输出结果见图:样张.JPG-*/#include using namespace std;/*Program*/char s10;int i=0;char encryptionCH(char x)si=x;char en10;if(si=A&si=a&si=V&si=v&siusing namespace std;/*Program*/int min(int a,int b,int c)int

2、 m=a;if(babc;cout#include using namespace std;int main()double x,fx;coutx; /*Program*/if(x0&x1&x1.6&xusing namespace std;void main(void)int num; int sum; /存放整数 num 各位数字之和int count; /存放整数 num 的位数coutnum;coutusing namespace std;/*Program*/char s10;int i=0;char encryptionCH(char x)si=x;char en10;if(si=

3、A&si=a&si=V&si=v&siusing namespace std;/*Program*/class Date int year,month,day; public: Date()year=0;month=0;day=0; Date(int Y,int M,int D)year=Y;month=M;day=D; SetD(int Y,int M,int D)year=Y;month=M;day=D; int getDay(); void show(); ; int Date:getDay()int n,i,k=0; if (year%100!=0 else i=0; if (mont

4、h=1 if (month=2 if (month=3 if (month=4 if (month=5 if (month=6 if (month=7if (month=8 if (month=9 if (month=10 if (month=11 if (month=12 if (k=1)return n;/* End */void Date:show()coutusing namespace std;const double PI=3.14159;/*Program*/class Point int x,y; public: Point()x=y=0; Point(int xx,int y

5、y) x=xx;y=yy; SetP(int xx,int yy) x=xx;y=yy; int getX()return x; int getY()return y; ; class Circle double radius; Point p1; public: Circle() p1.SetP(0,0); radius=0; Circle(Point pp,int r) p1.SetP(pp.getX(),pp.getY(); radius=r; SetCC(Point pp,int r)p1.SetP(pp.getX(),pp.getY(); radius=r; double getAr

6、ea(); void show(); ; double Circle:getArea() return PI*radius*radius; /* End */void Circle:show()coutusing namespace std;class shapeprivate:int l,w,h;public:shape(int, int, int);int is();/*Program*/shape:shape(int a,int b,int c) l=a;w=b;h=c; int shape:is() if(l&w&h)return 1; if(l=0 if(!l&w&h)|(!w&h&

7、l)|(!h&w&l) return 2; else return 3;/* End */void display(shape s)switch(s.is() case 1:coutusing namespace std;/*Program*/class Studentlong ID,ccj,yycj,sxcj;public:Student(long _ID, long _ccj, long _yycj, long _sxcj) ID=_ID; ccj=_ccj; yycj=_yycj; sxcj=_sxcj; long getID()return ID; int sum ()return ccj+yycj+sxcj; double avg () return (ccj+yycj+sxcj)/3; ;/* End */void main(void)Student s(201211145, 90, 80, 97);coutID:s.getID()endl; couttThe sum of source:s.sum()endl; couttThe avg of source:s.avg()endl;

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号