#include <iostream>
#include <string>
using namespace std;
//程式目的:行列互換
int main() {
string s[105];
int row = 0, col = 0, maxi=0;
while (getline(cin, s[row])) {
maxi = max(maxi, (int)s[row].length());
row++;
}
for (int i = 0; i < maxi; i++) {
for (int j = row - 1; j >= 0; j--) {
if (i >= (int)s[j].length()) { //當行比列的字串長度還長時輸出空格
cout << " ";
}
else {
cout << s[j][i];
}
}
cout << "\n";
}
return 0;
}
#include
#include
using namespace std;
//程式目的:行列互換
int main() {
string s[105];int row = 0, col = 0, maxi=0;
while (getline(cin, s[row])) {
maxi = max(maxi, (int)s[row].length());
row++;
}
for (int i = 0; i < maxi; i++) {
for (int j = row - 1; j >= 0; j--) {
if (i >= (int)s[j].length()) { //當行比列的字串長度還長時輸出空格
cout << " ";
}
else {
cout << s[j][i];
}
}
cout << "\n";
}
return 0;
}
抱歉,我按送出之後沒反應就一直按,結果多了好幾篇,不是故意刷版Q.Q