\b代表退格
,但是与按下退格键不一样,当前的光标会向前移动一位。
下面是《C++ Primer Plus(第6版)》中的一段代码:
//bondini.cpp -- using escape sequences
#include<iostream>
int main()
{
using namespace std;
cout << "\aOperation \"hyperHype\" is now activated!\n";
cout << "Enter your agent code: ________\b\b\b\b\b\b\b\b";
long code;
cin >> code;
cout << "\aYou entered " << code << "...\n";
cout << "\aCode verified! Proceed with Plan Z3!\n";
return 0;
}
其效果如下: