#include <iomanip>
#include <iostream>
using namespace std;
int main() {
cout << "Enter amount of strings : ";
int size = 0;
cin >> size;
string words[size];
int i = 0;
size_t max_length = 0;
while (i < size){
string word = "";
cout << " > ";
cin >> word;
words[i] = word;
if (word.length() > max_length)
max_length = word.length();
i++;
}
cout << endl;
i = 0;
while (i < size){
cout.width(max_length);
cout << right << words[i] << endl;
i++;
}
return 0;
}
Comments
Leave a comment