C++ Primer 第五版 练习答案 1.2节练习

来源:互联网 发布:淘宝申请天猫客服介入 编辑:程序博客网 时间:2024/05/16 10:35

1.3

#include<iostream>
using namespace std;
int main(){
cout<<"Hello, Wrold"<<endl;
return 0;
}

1.4

#include<iostream>
using namespace std;
int main(){
cout<<"The result of 5*6="<<endl<<5*6;
return 0;
}

1.6

不合法。因为有分号,不是完整的语句了。把第一第二个分号删除即可

1.16

#include<iostream>
using namespace std;
int main(){
int i,result=0;
while(cin>>i){
result=result+i;
}
cout<<result<<endl;
}

2.3

32

4294967264

32

-32

0

0