C++ 如何在控制台中仅清除几个先前输出的cout行?
当我在控制台中输出一个由3个字符串组成的电子邮件对象(发件人的地址、主题、电子邮件)时,如何让用户选择只清除这些内容而不是整个控制台C++ 如何在控制台中仅清除几个先前输出的cout行?,c++,cout,C++,Cout,当我在控制台中输出一个由3个字符串组成的电子邮件对象(发件人的地址、主题、电子邮件)时,如何让用户选择只清除这些内容而不是整个控制台 //MAIN MENU OPTION 1 SELECTED: // print list of all messages to the console void viewInbox() { vector<Message> inbox{ Message("jayleno@hotmail.com", "Knife you t
//MAIN MENU OPTION 1 SELECTED:
// print list of all messages to the console
void viewInbox()
{
vector<Message> inbox{
Message("jayleno@hotmail.com", "Knife you tonight", "Hey Sam, what kind of suit do you wanna be buried in?!"),
Message("paypalservices@hotmail.com", "Urgent from paypal.com", "Dear paypal user, someone has hacked your account. Give us your password now so we change it!"),
};
cout << "You have " << inbox.size() << " new messages.\n";
cout << "Index Subject" << '\n';
for (int i = 0; i < inbox.size(); ++i)
{
std::cout << "Message " << i << ": " << inbox[i].getSubject() << '\n';
}//end of for loop
cout << "Please enter number of message you would like to view\n";
int message_number;
cin >> message_number;
cout << "From: " << inbox[message_number].getAddress() << endl;
cout << "Subject: " << inbox[message_number].getSubject() << endl;
cout << inbox[message_number].getMessageText() << endl;
cout << "To close this message and return to your inbox, press 1\n";
//cin.clear(previous 4 cout lines above only);
}//end of viewInbox()
//选择了主菜单选项1:
//将所有消息的列表打印到控制台
void viewInbox()
{
矢量收件箱{
消息(“jayleno@hotmail.com“,“今晚给你刀”,“嘿,山姆,你想穿什么样的衣服?!”),
消息(“paypalservices@hotmail.com“,”来自paypal.com的紧急消息“,”亲爱的paypal用户,有人入侵了您的帐户。现在给我们您的密码,以便我们更改它!”,
};
我不想用标准C++来做,我认为你应该考虑使用一些库来开始编写图形应用程序(NCURSE,GTK+,QT,WinAPI……)