1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #include <iostream> #include <thread> #include <chrono> #include <string> using std::cout; using std::cin; using std::endl; using std::flush; using std::string; using std::this_thread::sleep_for; using std::chrono::seconds; void think() { constexpr int kDotsCount = 3; constexpr auto kDotDelay = seconds(1); cout << "<think>"; for (int i = 0; i < kDotsCount; ++i) { sleep_for(kDotDelay); cout << "." << flush; } cout << endl; } int main() { cout << "请输入您的问题:"; string question; getline(cin, question); think(); cout << "服务器繁忙,请稍后再试。" << endl; return 0; }
|