程序员专属倒计时

程序员专属倒计时: 

​​#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
#define R SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
#define Y SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN);
#define G SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
#define C SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN | FOREGROUND_BLUE);
#define B SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE);
#define P SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_BLUE);
#define I SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
#define W SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
using namespace std;
int d,h,m,s,clr;
void pt(int p){
	if(p<10)
		cout<<"0";
	cout<<p;
}
void bp(int m){
	Beep(m,250);
	Sleep(200);
}
int main(){
	do{
		system("cls");
		cout<<"Day(s):";
		cin>>d;
		cout<<"Hour(s):";
		cin>>h;
		cout<<"Minute(s):";
		cin>>m;
		cout<<"Second(s):";
		cin>>s;
	}while(h>23 || m>59 || s>59);
	while(d || h || m || s){
		system("cls");
		switch(clr){
			case 0:P break;
			case 1:B break;
			case 2:C break;
			case 3:G break;
			case 4:Y break;
			case 5:R break;
			case 6:I break;
			case 7:W
		}
		clr++;
		if(clr==8)
			clr=0;
		pt(d);
		cout<<":";
		pt(h);
		cout<<":";
		pt(m);
		cout<<":";
		pt(s);
		s--;
		sleep(1);
		if(s<0){
			m--;
			s=59;
		}
		if(m<0){
			h--;
			m=59;
		}
		if(h<0){
			d--;
			h=23;
		}
	}
	system("cls");
	W
	cout<<"Over";
	while(1){
		bp(523);
		bp(578);
		bp(659);
		bp(698);
		bp(784);
		bp(880);
		bp(990);
		Beep(1046,400);
		Sleep(500);
	}
	return 0;
}

​
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值