2、65;charc1='a',c2='b';floatx=1.2,y=2.4,z=-3.6;printf("a=%db=%2dc=%2d",a,b,c);printf("x=%f,y=%f,z=%f",x,y,z);printf("x+y=%.2fy+z=%.2fz+x=%.1f",x+y,y+z,z+x);printf("u=%6d,n=%9d",u,n);printf("c1='a'or%d(ASCII)",c1);printf("c2='b'or%d(ASCII)",c2);}运行结果
3、:a=3b=4c=5x=1.200000,y=2.400000,z=-3.600000x+y=3.60y+z=-1.20z+x=-2.4u=51274,n=128765c1='a'or97(ASCII)c2='b'or98(ASCII)Pressanykeytocontinue第七题之一://---求圆柱的相关数据--#include"stdio.h"voidmain(){floatr,h,c,s1,s2,v,p=3.1415926;printf("请输入圆半径和圆柱高");scanf("%f%f",&r,&
4、h);c=2*p*r;s1=p*r*r;s2=2*s1+2*p*r*h;v=p*r*r*h;printf("圆周长=%.2f圆面积=%.2f圆柱表面积=%.2f圆柱体积=%.2f",c,s1,s2,v);}第七题之二://---求圆柱的相关数据--#include"iostream.h"#include"iomanip.h"voidmain(){floatr,h,c,s1,s2,v,p=3.1415926;cout<<"请输入圆半径和圆柱高"<>r>>h;c=2*p*r;s1=
5、p*r*r;s2=2*s1+2*p*r*h;v=p*r*r*h;cout<6、/9*(F-32);printf("摄氏温度%.2f",c);}第八题之二://---根据华氏温度求摄氏温度--#include"iostream.h"#include"iomanip.h"voidmain(){floatF,c;cout<<"请输入华氏温度"<>F;c=5.0/9*(F-32);cout<7、oidmain(){floatx,y;cout<<"输入x=";cin>>x;if(x<1.0)y=x*x-1.0;elseif(1.0<=x&&x<10.0)y=2.0*x-1.0;elsey=3.0*x-11.0;cout<<"y="<>a>>b>>c;if(a<=b)a=b;if(a<=c)a=c;cout<<"最大数为:"<8、>a;d=a;p10:j=j-1;b=a/pow(10,j);if(b==0)gotop10;j=j+1;cout<