MIKOLAY Posted April 30, 2005 Report Share Posted April 30, 2005 Как вот сделать задержку в С++ так, чтобы можно было сделать так, чтобы сначала выводилась одна точка,(с помощью std::cout), затем задержка(в 2 секунды), а затем ещё раз точка и т.д. Link to comment Share on other sites More sharing options...
Mix_x Posted April 30, 2005 Report Share Posted April 30, 2005 Может попробовать вставить какую-нибудь небольшую функцию "между точками". Link to comment Share on other sites More sharing options...
aTeos Posted April 30, 2005 Report Share Posted April 30, 2005 #include <time.h> // Функция задержки, параметр - время задержки в миллисекундах void delay (int ms) { unsigned long t1 = clock()/CLK_TCK*1000+ms, t2 = 0; while ((t2 = clock()/CLK_TCK*1000) < t1); } Думаю, эта функция у тебя заработает. Link to comment Share on other sites More sharing options...
gvozd Posted April 30, 2005 Report Share Posted April 30, 2005 В VB я юзаю API-функцию Sleep, по идее и в С++ она должна быть. Link to comment Share on other sites More sharing options...
Варлок Posted April 30, 2005 Report Share Posted April 30, 2005 Sleep точно есть. ...#include <iostream>#include <windows.h> //Заголовочный файл с объявлениями основных API-функций. ....for (int i(0); i < n; ++i) // n = кол-ву точек. { std::cout << '.'; Sleep(2000); //API-функция задержки. Принимеат значение в милисекундах. }.... В С++ Builder'e работает. Link to comment Share on other sites More sharing options...
MIKOLAY Posted May 6, 2005 Author Report Share Posted May 6, 2005 Thanks всем! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now