(c语言+easyx+vs2022)简单 读秒,计时

#include 
#include 
#include
clock_t Start_time;
clock_t End_time;
int time_1;
char str[100];
int main() {
	initgraph(200, 200, SHOWCONSOLE);//init 初始化  graph 图像窗口  SHOWCONSOLE 显示控制台
	setbkcolor(RGB(225, 115, 100));//设置背景颜色
	BeginBatchDraw();	//双缓冲绘图,防止屏闪

	Start_time = clock();
	while (1) {
		cleardevice();
		End_time = clock();
		time_1 = (int)((End_time - Start_time) / CLOCKS_PER_SEC);
		settextstyle(20, 0, "宋体");
		setcolor(BLACK);//
		sprintf_s(str, " %d s", time_1);
		outtextxy(10, 10, str);
		EndBatchDraw();//双缓冲绘图
	}
	return 0;
}

你可能感兴趣的:(easyx,c语言,开发语言)