社区讨论

关于数字打印

灌水区参与者 3已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@lpp8gbot
此快照首次捕获于
2023/12/03 16:40
2 年前
此快照最后确认于
2023/12/03 19:12
2 年前
查看原帖
CPP
#include <bits/stdc++.h>
using namespace std;
int i = 0, a[10001];
string s;

int main() {
	cin >> s;
	for (int e = 0; e <= s.length(); e++) {
		a[e] = s[e] - '0';
		i = a[e];
		if (i == 0) {
			cout << " _" << endl;
			cout << "| |" << endl;
			cout << "|_|" << endl;
		}
		if (i == 1) {
			cout << "  " << endl;
			cout << "  |" << endl;
			cout << "  |" << endl;
		}
		if (i == 2) {
			cout << " _" << endl;
			cout << " _|" << endl;
			cout << "|_ " << endl;
		}
		if (i == 3) {
			cout << " _" << endl;
			cout << " _|" << endl;
			cout << " _|" << endl;
		}
		if (i == 4) {
			cout << "  " << endl;
			cout << "|_|" << endl;
			cout << "  |" << endl;
		}
		if (i == 5) {
			cout << " _" << endl;
			cout << "|_ " << endl;
			cout << " _|" << endl;
		}
		if (i == 6) {
			cout << " _" << endl;
			cout << "|_ " << endl;
			cout << "|_|" << endl;
		}
		if (i == 7) {
			cout << " _" << endl;
			cout << "  |" << endl;
			cout << "  |" << endl;
		}
		if (i == 8) {
			cout << " _" << endl;
			cout << "|_|" << endl;
			cout << "|_|" << endl;
		}
		if (i == 9) {
			cout << " _" << endl;
			cout << "|_|" << endl;
			cout << " _|" << endl;
		}
	}
	return 0;
}
怎么样才能把输出怎么变成横的???

回复

3 条回复,欢迎继续交流。

正在加载回复...