#VC08. 趣味编程08选择题
趣味编程08选择题
- 为了让计算机完成一个完整的任务而编写的一串指令序列称为( )。 {{ select(1) }}
- 命令
- 口令
- 程序
- 软件
- 阅读程序写结果。
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a, b, c;
a = 3;
b = 4;
c = a * a + b * b;
cout << a << '*' << a << '+' << b << '*' << b << '=' << setw(2) << c << endl;
return 0;
}
{{ select(2) }}
- 25
- a*a+b*b=25
- 3*3+4*4=25
- 3 * 3 + 4 * 4 = 25
- 完善程序。
已知 a 为 15,b 为 3,输出 a-b 的竖式计算。
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a, b, c;
a = 15;
b = 3;
c = a - b;
cout << setw(5) << a << endl;
cout << setw(2) << '-' << setw(3) << ___ << endl;
cout << "-------" << endl;
cout << _____ << c << endl; // 占5个字符宽度
return 0;
}
{{ select(3) }}
- b, setw(5)
- b, setw(2)
- 3, setw(3)
- 3, setw(10)