ahmed0saber

Wait for milliseconds in C++

Nov 4th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include<iostream>
  2. #include<time.h>
  3. using namespace std;
  4. void delay(clock_t a)
  5. {
  6.     clock_t start;
  7.     start  = clock();
  8.     while(clock()-start<a)
  9.     {
  10.  
  11.     }
  12. }
  13. int main()
  14. {
  15.     delay(100);
  16.     cout << "A";
  17.     delay(100);
  18.     cout << "h";
  19.     delay(100);
  20.     cout << "m";
  21.     delay(100);
  22.     cout << "e";
  23.     delay(100);
  24.     cout << "d";
  25.     delay(100);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment