C++制表符"\t”的用法
#include <iostream>int main()
{
std::cout << "The size of a short int is:\t" << sizeof(short int) <<"\n";
std::cout << "The size of an int is:\t" << sizeof(int) << "\n";
std::cout << "The size of a long int is:\t" << sizeof(long int) << "\n";
std::cout << "The size of a char is:\t" << sizeof(char) << "\n";
std::cout << "The size of a float is:\t" << sizeof(float) << "\n";
std::cout << "The size of a double is:\t" << sizeof(double) << "\n";
std::cout << "The size of a bool is:\t" << sizeof(bool) << "\n";
return 0;
}
显示出来却是:
The size of a short int is: 2
The size of an int is: 4
The size of a long int is: 4
The size of a char is: 1
The size of a float is: 4
The size of a double is: 8
The size of a bool is: 1
Press any key to continue
制表符没起作用吗?
追问:问题是,在每一行我都输入了“\t”,但是貌似只有几行有效果,其它行都没效果。