[英]Sleep(4000) Show . for each 1000 (C++)
Note I am a beginner. 注意我是一个初学者。
What I am trying to do is display a "." 我想做的是显示一个“。” for each 1000 seconds in the timer. 计时器中的每1000秒。 I would like the "." 我想要“。” to be displayed next following the cout. 将在提示之后显示。
#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;
}
You can use a simple for loop to do this. 您可以使用简单的for循环来执行此操作。
for(int i = 0; i < 4; i++){
Sleep(1000);
cout << ".";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.