簡體   English   中英

Sleep(4000)顯示。 每1000(C ++)

[英]Sleep(4000) Show . for each 1000 (C++)

注意我是一個初學者。

我想做的是顯示一個“。” 計時器中的每1000秒。 我想要“。” 將在提示之后顯示。

#include <iostream>
#include <windows.h>


using namespace std;

int main()

{

    char uname;
    char pword;

    cout << "Initializing EKG";
    Sleep(4000);
      /* while/for Sleep(1000) cout << "."
         while Sleep(1000*2) cout << "."
      */
     //Something along those lines I am trying to achieve. 
     //Can't I use a ++ or something similar to increase the . to .. to ... to ....? 

    return 0;

}

您可以使用簡單的for循環來執行此操作。

for(int i = 0; i < 4; i++){
      Sleep(1000);
      cout << ".";
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM