c++基础小项目,足球球员身价评估系统,超简易
2021/7/18 20:06:23
本文主要是介绍c++基础小项目,足球球员身价评估系统,超简易,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
#include<iostream>
#include<cstdio>
#include<cstring>
#include<windows.h>
//#include<graphics.h>
using namespace std;
double ss(int s[],int n);
double cm(int s[],int n);
double cb(int s[],int n);
double count(double a,int b);
void color(int x)//字体颜色
{
if(x>=0&&x<=15)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x);
else
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7);
}
void cshcxhs();
//void far settextstyle(int font,int direction,char size);
struct shuju //结构体
{
string name;
string weizhi;
string country;
int year;
}player;
int main()//主函数
{
cshcxhs();
double money;
string nengli[5]={"攻击意识","防守意识","盘带射门","防守技巧","身体素质"};
int a,s[5];
cout<<"球员姓名: ";cin>>player.name;cout<<endl;
cout<<"国籍: ";cin>>player.country;cout<<endl;
cout<<"年龄: ";cin>>player.year;cout<<endl;
cout<<"前锋:ss,中场cm,后卫cb"<<endl;
cout<<"位置: ";cin>>player.weizhi;cout<<endl;
for(int i=0;i<5;i++)
{
cout<<nengli[i]<<": ";
cin>>s[i];
cout<<endl;
}
if(player.weizhi=="ss")
{
money=ss(s,5);
money=count(money,player.year);
cout<<money<<"亿欧元";
}
if(player.weizhi=="cm")
{
money=cm(s,5);
money=count(money,player.year);
cout<<money<<"亿欧元";
}
if(player.weizhi=="cb")
{
money=cb(s,5);
money=count(money,player.year);
cout<<money<<"亿欧元";
}
}
double ss(int s[],int n)//前锋
{
double money=0,r=s[0]+s[2]+s[4];
if(r>=240)
{
money=1.0*r/300*1.8;
}
else if(r>=210)
money=1.0*r/300*0.8;
if(r<210)
money=1.0*r/300*0.3;
return money;
}
double cm(int s[],int n)//中场
{
double money=0;
for(int i=0;i<5;i++)
{
money=money+s[i];
}
if(money>=400)
money=1.0*money/500*1.2;
if(money<400)
{
for(int i=0;i<5;i++)
{
if(s[i]>=90)
break;
if(i==4)
{
money=1.0*money/500*0.6;
return money;
}
}
money=1.0*money/500*0.9;
}
return money;
}
double cb(int s[],int n)//后卫
{
double money=0,r=s[1]+s[3]+s[4];
if(r>=270)
{
money=1.0*r/300*1.1;
}
else if(r>240)
money=1.0*r/300*0.8;
if(r<240)
money=1.0*r/300*0.6;
return money;
}
double count(double a,int b)//年龄折算
{
if(b>35)
a=a*0.1;
if(b<=35&&b>28)
a=a*0.5;
if(b<=28)
a=a;
return a;
}
void cshcxhs() //开场画面
{
//settextstyle(4,0,6);
system("title 曼联勇往直前");
//color(71) ;
system("color 71");
cout<<" ****** * ****** * "<<endl;
cout<<" * * * * * "<<endl;
cout<<" * * * * * "<<endl;
cout<<" ***** * ***** * * "<<endl;
cout<<" * * * * *** * "<<endl;
cout<<" * * * * * "<<endl;
cout<<" * * * * * "<<endl;
Sleep(2000);
system("cls");
}
//自己根据实况2021估计的数据,仅做娱乐判断
这篇关于c++基础小项目,足球球员身价评估系统,超简易的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-15PingCAP 黄东旭参与 CCF 秀湖会议,共探开源教育未来
- 2024-05-13PingCAP 戴涛:构建面向未来的金融核心系统
- 2024-05-09flutter3.x_macos桌面os实战
- 2024-05-09Rust中的并发性:Sync 和 Send Traits
- 2024-05-08使用Ollama和OpenWebUI在CPU上玩转Meta Llama3-8B
- 2024-05-08完工标准(DoD)与验收条件(AC)究竟有什么不同?
- 2024-05-084万 star 的 NocoDB 在 sealos 上一键起,轻松把数据库编程智能表格
- 2024-05-08Mac 版Stable Diffusion WebUI的安装
- 2024-05-08解锁CodeGeeX智能问答中3项独有的隐藏技能
- 2024-05-08RAG算法优化+新增代码仓库支持,CodeGeeX的@repo功能效果提升