C++计分板 Socerboard

81 篇文章 0 订阅
36 篇文章 0 订阅
该程序由Carlgood编程,用户可以选择是否启用计时功能,计时以秒为单位。比赛中,用户可以输入分数,按特定键进行中场休息和结束游戏。程序在DEV-C++5.11环境下编写,使用了iostream、cmath等库来实现功能。
摘要由CSDN通过智能技术生成
//
//Created by Carlgood.
//
//Note:This program is written in version DEV-C++ 5.11.
# include <iostream>
# include<cmath>
# include<string>
# include<cstring>
# include<cstdio>
#include<conio.h>
# include<algorithm>
# include<sstream>
# include<windows.h> 
# define This_program_is_written_by_Carlgood_Programming_Studio 9876543210
using namespace std;
int a,b;
int main()
{
	char ch; 
	a=0;
	b=0;
	system("title Socerboard-1.01.82759");
	int r,t;
	cout<<"程序制作:Carlgood Programming Studio\n"; 
	cout<<"请问您需要计时吗?(时间到就结束)需要请输入1,不需要请输入0。\n"; 
	cin>>r;
	if(r)
	{
		cout<<"请问您需要多少时长?(单位:秒)\n";
		cin>>t;
	}
	while(1)
	{
		system("cls");
		cout<<"Note:按c键输入,按g键结束,中场休息按s,按o继续。\n";
		cout<<" 比分情况\n";
		cout<<" |"<<a<<":"<<b<<"|\n";
		if(kbhit())
        {
            ch=getch();
            if(ch==99)
            {
            	system("cls");
            	cout<<"   输入界面\n_______________\n"; 
            	cout<<"甲方分数:";
				cin>>a;
				cout<<"乙方分数:";
				cin>>b;
            }
            if(ch==103)
            {
            	break;
            }
            if(ch==115)
            {
            	while(1)
            	{
            		system("cls");
            		cout<<"中场休息中~";
            		if(kbhit())
            		{
            			ch=getch();
            			if(ch==111)
            			{
            				break;
						}
					}
				}
			}
        }
        if(r)
		{
			if(t==0)
	        {
	        	break;
			}
			cout<<"还剩:"<<t<<"秒。";
	        t--;
			for(long long rrr=0;rrr<=646888888;rrr++)
			{
				//等待1秒
				//这里不用Sleep(1000);的原因是前面的代码运行耗费了一些时间这导致间隔比一秒钟要多。 
			}
		}
	}
	system("cls");
	cout<<"比赛结束!\n";
	cout<<"比赛结果是:";
	Sleep(987);
	if(a>b)
	{
		cout<<"甲";
		Sleep(234);
		cout<<"赢";
		Sleep(234);
		cout<<"!"; 
	}
	else if(a<b)
	{
		cout<<"乙";
		Sleep(234);
		cout<<"赢";
		Sleep(234);
		cout<<"!"; 
	}
	else
	{
		cout<<"平";
		Sleep(234);
		cout<<"局";
		Sleep(234);
		cout<<"!"; 
	}
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值