c++中的转义字符

转义字符用于标识不能显示的ascii字符

一般以\为开头

常用的有\n换行符,\\反斜杠,\t水平制表符,一个\t代表了8个位置,一般用来输出的时候对齐,如果前面不够自动补齐,如果超了从第8个开始重新计数,效果可以叠加,但是叠加后也是8个一循环

  cout << "a\n";
cout << "a\\n"<<endl;
cout << "a\thello"<<endl;
  cout << "aaaaaaaaaaaa\t\thello"<<endl;
  cout << "aaaaaaaaaaaa\thello"<<endl;
  cout << "aaaaaa\t\thello"<<endl;
  cout << "aaaaaa\thello"<<endl;
aaaaaaaaaaaa            hello
aaaaaaaaaaaa    hello
aaaaaa          hello
aaaaaa  hello
posted @ 2022-04-07 13:00  纸包鱼  阅读(468)  评论(0)    收藏  举报