Already the computer hangs on the tabs, but I can not understand how to make a normal tab in the console. Code for example:
cout << "name" << "\t[" << "12:10:10" << "] "; cout << "\t[" << "qwe" << "]"; cout << "\t<" << "name" << "> : " << "message" << endl; cout << "name2" << "\t[" << "12:10:10" << "] "; cout << "\t[" << "rqwqsvdwdfqweqr" << "]"; cout << "\t<" << "name" << "> : " << "message" << endl; Expected output:
name [12:10:10] [qwe] <name> : message name2 [12:10:10] [rqwqsvdwdfqweqr] <name> : message The resulting conclusion:
name [12:10:10] [qwe] <name> : message name2 [12:10:10] [rqwqsvdwdfqweqr] <name> : message I have already tried the usual tabulators \t , vertical tabulators \v (which I still don’t understand how they work), used setw() , but nothing setw() . You can, of course, manually read the length of the name in brackets, and depending on the size, you can give either \t or \t\t or \t\t\t , but can you really not make it all easier?
setwandresetiosflags- Nicksetw? - Harryиспользовал setw(), но ничего не выходит.show, please, the proper use of setw in my example. - Vitali