}
1.9题
#include
using namespace std;
int main()
{
int a,b,c;
int add(int x,int y); cin>>a>>b;
c=add(a,b);
cout<<"a+b="<}
int add(int x,int y)
{int z;
z=x+y;
return(z);
}
第二章
2.3题
#include
using namespace std;
int main()
{char c1='a',c2='b',c3='c',c4='\101',c5='\116'; cout<cout<<"\t\b"<return 0;
}
2.4题
#include
using namespace std;
int main()
{char c1='C',c2='+',c3='+';
cout<<"I say: \""<cout<<"\t\t"<<"He says: \"C++ is very interesting!\""<< '\n';
return 0;
}
2.7题
#include
using namespace std;
int main()
{int i,j,m,n;
i=8;
j=10;
m=++i+j++;
n=(++i)+(++j)+m;
cout<
}
2.8题
#include
using namespace std;
int main()
{char c1='C', c2='h', c3='i', c4='n', c5='a';
c1+=4;
c2+=4;
c3+=4;
c4+=4;
c5+=4;
cout<<"password is:"<return 0;
}
第三章
3.2题
#include
#include
using namespace std;
int main ( )
{float h,r,l,s,sq,vq,vz;
const float pi=3.1415926;
cout<<"please enter r,h:";
cin>>r>>h;
l=2*pi*r;
s=r*r*pi;
sq=4*pi*r*r;
vq=3.0/4.0*pi*r*r*r;
vz=pi*r*r*h;
cout<<cout<<"l= "<cout<<"s= "<cout<<"sq="<cout<<"vq="<cout<<"vz="<return 0;
}
3.3题
#include
using namespace std;
int main ()
{float c,f;
cout<<"请输入一个华氏温度:";
cin>>f;
c=(5.0/9.0)*(f-32); //注意5和9要用实型表示,否则5/9值为0
cout<<"摄氏温度为:"<return 0;
};