Please hELP!Columns to adjust accordingly

--
Last edited on
Well, you obviously know that the strings have a length() function. Just use that along with setw(). Example:

1
2
3
4
5
6
7
int max_length = object_one.length();

if (object_two.length() > max_length)
	max_length = object_two.length();

cout << setw(max_length) << "stuff" << endl;
cout << setw(max_length) << "more stuff" << endl;
Topic archived. No new replies allowed.