![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C&C++
xiueer
这个作者很懒,什么都没留下…
展开
-
第三章课后练习
第一题//3.1#includeusing namespace std;const int tran=12;int main(){ void trans(int); int h_cun; int h_chi,h_cun1; cout<<"input your hight______\b\b\b\b\b\b"; cin>>h_cun; trans(h_cun); re原创 2014-11-25 20:34:44 · 450 阅读 · 0 评论 -
第四章 4.1,4.2
数组只有在定义数组时才能使用初始化,此后就不能使用了。不能将一个数组赋值给另一个数组。可以使用下标分别给数组的元素赋值。intcard[4]={3,4,5,6};//okayint hand[4];hand[4]={3,4,5,6};//notallowedhand=card;//notallowed字符串 C-风格字符串char[8]={‘f’,’a’,原创 2014-11-30 15:15:42 · 374 阅读 · 0 评论 -
第三章
3.2 const限定符符号常量const type name=value;//在声明时对const初始化3.3.4浮点数会降低精度#includeint main(){ using namespace std; float a=2.34e+22f; float b=a+1.0f; cout<<"a="<<a<<endl; cout<<"b-a="<<b-a<<原创 2014-11-25 21:05:36 · 555 阅读 · 0 评论 -
第四章4.3,4.4
4.3 string 类用cin将键盘输入存储在string对象中可以使用数组表示法访问存储在string对象中的字符,如str[2]。允许将一个string对象赋值给另一个string类。可以使用 + 将两个string对象合并起来,也可以使用 +=将字符串附加到string对象的末尾。string str3;str3=str1+str2;str1+=str2;原创 2014-11-30 21:07:13 · 338 阅读 · 0 评论