Time Counter问世,以后会改进
  • 板块灌水区
  • 楼主Jerryfish
  • 当前回复10
  • 已保存回复10
  • 发布时间2021/10/25 22:15
  • 上次更新2023/11/4 02:15:11
查看原帖
Time Counter问世,以后会改进
573363
Jerryfish楼主2021/10/25 22:15
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;

string m;
string unit;
int i = 1;

int main(){
	system("color 02"); 
	if(i == 1)
	    cout << "^v^欢迎使用Time Counter(TC)计时器" << endl;
	else
		cout <<  "Welcome TC" << endl;
	Sleep(100);
	if(i == 1){cout << "Input Time Unit(ITU->输入时间单位)";}
	else
		cout << "ITU";
	cout << "(s(秒),min(分),h(时))";
	cin >> unit;
	if(unit != "s"&&unit != "min"&&unit != "h")
	{
		system("cls");
		system("color 70"); 
		cout << "error!!!";
		Sleep(1000);
		i++;
		system("cls");
		main();
	}
	if(i == 1)
		cout << "Input Time(<=10^6)(须为整数)(IPT):";
	else
		cout << "IPT:";
	cin >> m;
	unsigned long long n = 0;
	bool flag = false;
	for(int i = m.length()-1, j = 1; i >= 0; i--, j *= 10) 
	{
		int tmp = m[i]-'0';
		if(tmp == 0&&flag==false)
			n=1ll*n*10;
		else {n = n+1ll*tmp*j; flag = true;}
		if(n >= pow(10,6)) 
		{
			i++;
			system("cls");
			system("color 04"); 
			cout << "MLE!!!";
			Sleep(1000);
			for(int i = 1; i <= 1000; i++)
				cout<<"999999999999999999999999999999999999999999999999999999"<<endl;
			Sleep(2000);
;			system("cls");
			main();
		}
		if(tmp > 9 || tmp < 0)
		{
			system("cls");
			system("color 70"); 
			cout << "error!!!";
			Sleep(1000);
			i++;
			system("cls");
			main();
		}
	}
	if(unit == "s")
	{
		system("cls");
		for(double i = 0.0; i <= n; i+=0.1){
			cout << i;
			Sleep(100);
			system("cls");
		} 
		MessageBox(GetForegroundWindow(),"时间到了","时间到了",1);
	}
	if(unit == "min")
	{
		system("cls");
		for(double i = 0.0; i <= n; i+=0.1){
			cout << i;
			Sleep(6000);
			system("cls");
		} 
		MessageBox(GetForegroundWindow(),"时间到了","时间到了",1);
	}
	if(unit == "h")
	{
		system("cls");
		for(double i = 0.0; i <= n; i+=0.1){
			cout << i;
			Sleep(360000);
			system("cls");
		} 
		MessageBox(GetForegroundWindow(),"时间到了","时间到了",1);
	}
	i++;
	main();
} 
2021/10/25 22:15
加载中...