Answers for "c++ run loop for 5 seconds"

C++
3

c++ run loop for 5 seconds

#include <iostream>
#include <windows.h>
using namespace std;
int main(){

	for (int i = 0; i < 5; i++) {
		cout << i << endl;
		Sleep(1000); // sleep for 1 second(1000 milliseconds)
	}
}
Posted by: Guest on April-16-2022

Code answers related to "c++ run loop for 5 seconds"

Browse Popular Code Answers by Language