c++ while循环延迟输出

#include <iostream>
#include <ctime>
using namespace std;

int main()
{
	float sec, delay;
	clock_t start;
	
	cout << "enter the delay sec: \n";
	cin >> sec;
	delay = sec * CLOCK_PER_SEC;
	start = clock();
	while (clock() - start < delay);
	cout << "done\n";
	
	return 0;
}

 

你可能感兴趣的:(C++,c,C#)