水平制表符\t的作用是跳到下一个tab的位置,一般用于使得输出的数据整齐地对齐。
示例:输出hello world!
#include <iostream>
using namespace std;
int main()
{
cout << "a\thello world!" << endl;
cout << "ab\thello world!" << endl;
cout << "abc\thello world!" << endl;
cout << "abcd\thello world!" << endl;
return 0;
}
这样不管hello world!左侧的数据怎么变,hello world! 的首字母始终是对齐的。