|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- // 横式与竖式
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main() {
- int x, y;
- cout << "请输入 x :";
- cin >> x;
- cout << "请输入 y :";
- cin >> y;
- cout << endl;
- cout << x << " + " << y << " = " << x + y << endl;
- cout << setw(20) << right << x << endl;
- cout << "+";
- cout << setw(19) << right << y << endl;
- cout << setfill('-') << setw(20) << "" << endl;
- cout << setfill(' ') << setw(20) << right << x + y << endl;
- return 0;
- }
复制代码
执行结果:
- 请输入 x :123456
- 请输入 y :612345
- 123456 + 612345 = 735801
- 123456
- + 612345
- --------------------
- 735801
复制代码 |
|