Doesn`t `setw` set the width of the column to which the data is printed?; whereas \t sets the width of the column separating the 2 data columns.
e.g.
cout<<setw(3)<< i<<"\t"<<setw(5 )<<i*i<<"\n"; //might keep the data columns tidier.
\t does not set the width to anything, it is a character and how it is handled normally depends on the terminal to which you send it.
Commonly the terminal moves the output cursor to the next column multiple of 8.
Comment