slowing the speed of for loop
c++, for-loop
Solution
use `Sleep(3000);` to wait for 3000 milliseconds for example
#include <iostream>
#include <stdlib.h>
#include <Windows.h>
using namespace std;
int main(int argc,char**argv){
cout<<"a"<<endl;
Sleep(3000);
cout<<"b"<<endl;
return 0;
}
Problem
``` for(;;) { int rand_number = rand() % 2; cout << rand_number; } ``` These loops generates the 1's and 0's across the screen like the matrix movie (LOL) but the code executes really fast is there any way that we make the numbers appear slowly?