分享
分享赚钱 收藏 举报 版权申诉 / 15

类型C++第一单元复习题程序题满分答案.docx

  • 上传人:gnk289057
  • 文档编号:6111216
  • 上传时间:2019-03-27
  • 格式:DOCX
  • 页数:15
  • 大小:28.80KB
  • 配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    C++第一单元复习题程序题满分答案.docx
    资源描述:

    1、题目一:2/1+3/2+5/3+=?int i,t;int a=2,b=1;double m;sum=0;for(i=1;i0)n=n/10;count+;return count;题目四x1=cos( a*x0)答案一:float fun(float a) float x1=0.0;float x0,d;x0=x1;x1=cos(a*x0);d=x1-x0;if(fabs(d)1E-6);return x1;答案二:float fun(float a)float x1=0.0,x0; do x0=x1; x1=cos(a*x0) ; while(fabs(x0-x1)=1e-6) ;retu

    2、rn x1;题目五完成如下分段函数,函数见图: 函数.JPG输出结果见图:样张.JPG-*/#include #include using namespace std;int main()double x,fx;coutx; /*Program*/if(x0void main(void)int num; int sum; /存放整数 num 各位数字之和int count; /存放整数 num 的位数coutnum;coutusing namespace std;/*Program*/char encryptionCH(char ch)if(ch=Adouble total(int num_p

    3、,int num_s);const double pullover=89.5;/毛衣价格const double shawl=149.5;/披肩价格void main()int num_p;/购买的毛衣件数int num_s;/购买的披肩件数coutnum_p;coutnum_s;cout=3)i=89.5*num_p*0.6;else i=89.5*num_p;if(num_s=3)j=149.5*num_s*0.6;else j=149.5*num_s;total=i+j;if(total=500) total=total*0.9;return total;或者double total(i

    4、nt num_p,int num_s)double i,j,total,d,f;if(num_p=3) d=0.6;else d=1;if(num_s=3) f=0.6;else f=1;total=89.5*num_p*d+ 149.5*num_s*f;if(total=500) total=total*0.9;return total;/* End */题目九:编写一个程序,从键盘输入 a, op, b。其中 a, b 为数值;op 为字符,限制为+、-、*、/ 。 计算表达式 a op b 的值,并输出结果。注意:输出语句必须输出一个回车符号。运行结果见图 1,2,3-*/#includ

    5、e using namespace std;void main() float a,b; char op; coutaopb; switch(op) /*Program*/case+:coutusing namespace std;/*Program*/int min(int a,int b)int k;k=aabc;coutusing namespace std;/*Program*/float fun(float c)float f=0;f=c*9/5+32;return f;/* End */int main()float c;coutc;coutusing namespace std;

    6、void prn_pict(int m,int n)/*Program*/int i,j;char ch=A;for(i=1;im;coutn;prn_pict(m,n);/*-【程序设计】-题目十三输入一串字符串,以“?“号结束,输出其中的字母个数和数字个数。-*/#include using namespace std;void main()int nl = 0, ng = 0;char ch;cin.get(ch);while(ch != ?) /*Program*/if(ch=Avoid main(void)int i,a5=5,7,12,25,35;/*Program*/for(i=

    7、0;i using namespace std;void main() int x,y,z;cinxyz;int max;/*Program*/if(xy) max=x;else max=y;if(zmax) max=z;/* End */cout#include using namespace std;double fx(double x);int main()double a;couta; cout0/*Program*/bool prime(int n) int i,j;j=int(sqrt(n);for (i=2; iusing namespace std;void main() int m, k, c = 0;coutm;k = 2;coutm=;while(m != 1)/*Program*/while(m%k=0) coutk;c=m-k;if(c)cout“*“;m/=k;/* End */k+;coutendl;

    展开阅读全文
    提示  道客多多所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:C++第一单元复习题程序题满分答案.docx
    链接地址:https://www.docduoduo.com/p-6111216.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    道客多多用户QQ群:832276834  微博官方号:道客多多官方   知乎号:道客多多

    Copyright© 2025 道客多多 docduoduo.com 网站版权所有世界地图

    经营许可证编号:粤ICP备2021046453号    营业执照商标

    1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png



    收起
    展开