练习1.3
#include <iostream>
using namespace std;
int main()
{
int s(2);
cout << "Enter %d number" << s << std::endl;
int v1, v2;
cin >> v1 >> v2;
cout << "The sum of " << v1 << " and " << v2 << " is " << v1 + v2 << std::endl;
system("pause");
return 0;
}
练习1.4
#include <iostream>
using namespace std;
int main()
{
int s(2);
cout << "Enter %d number" << s << std::endl;
int v1, v2;
cin >> v1 >> v2;
cout << "The mutiply of " << v1 << " and " << v2 << " is " << v1 *v2 << std::endl;
system("pause");
return 0;
}
练习1.6
不合法,在分号以后本句结束,而下句没有输出流, <<会显示非法。
练习1.7
在注释中遇到意外的文件结束
练习1.8
1,2正确,3,4错误
原因:注释不可充当输出语句。
练习1.9
#include "source.h"
#include <iostream>
using namespace std;
int main()
{
int s(49),sum(0);
while (++s <= 100)
{
sum += s;
}
cout << "The sum of value add