#include<bits/stdc++.h>
#include<windows.h>
#include <conio.h>
using namespace std;
float score(int i, int sum)
{
switch (i)
{
case 1:
return i * 20 + 1.0 / sum * 80;
break;
case 2:
return i * 20 + 1.0 / sum * 90;
break;
case 3:
return i * 25 + 1.0 / sum * 70;
break;
case 4:
return i * 30 + 1.0 / sum * 60;
break;
case 5:
return i * 35 + 1.0 / sum * 50;
break;
case 6:
return i * 40 + 1.0 / sum * 40;
break;
}
}
void Slowsay(string a)
{
int l = a.size();
for(int i = 0;i < l;i++)
{
cout<<a[i];
Sleep(30);
}
printf("\n");
}
int f(int a)
{
if(a == 1)
{
int b = rand() % 10 + 1;
int c;
int d = 0;
Slowsay("开始!");
while(cin>>c)
{
if(c < b)
{
Slowsay("猜小了");
d++;
}
if(c > b)
{
Slowsay("猜大了");
d++;
}
if(c == b)
{
Slowsay("恭喜你,猜对了!");
d++;
cout<<"你一共猜了"<<d<<"次 "<<endl;
cout<<"你的分数是:"<<score(a,d)<<endl;
system("pause");