修练者
增加了日志和防误触功能,并修复了一些Bug
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int input1,rk,sk=0;
int card[9];
string grade[9]={""," \\ A / "," \\ A / "," \\ A / "," \\ S / "," \\ A / "," \\ A / "," \\ S / "," \\SSR/ "},people[9]={"","羊大婶","菲菲","沐沐","BUG狼","小程","小呆","布丁","酷丁猫"},input;
string rizhi[10005];
int rzcnt;
string tostr(int x){
stringstream ss;
ss<<x;
string ans;
ss>>ans;
return ans;
}
int main(){
system("title 酷丁名人堂 v2.0");
::MessageBox(NULL, TEXT(" 请调为全屏, 否则可能会有贴图bug!\n 别问为什么, 说多了都是泪(doge)"), TEXT("温馨提示"), 0);
while(true){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n 酷丁名人堂 ";
cout<<"\n □×"<<sk<<endl;
cout<<"─────────────────────────────────────────────\n";
cout<<"╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ \n";
for(int i=1;i<=4;i++)
if(card[i])
cout<<"│"<<grade[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n";
cout<<"│ │ │ │ │ │ │ │ \n";
for(int i=1;i<=4;i++)
if(card[i]-1==1)
cout<<"│★ │ ";
else if(card[i]-1==2)
cout<<"│★★ │ ";
else if(card[i]-1==3)
cout<<"│★★★ │ ";
else if(card[i]-1==4)
cout<<"│★★★★ │ ";
else if(card[i]-1>=5)
cout<<"│★★★★★ │ ";
else
cout<<"│ │ ";
cout<<"\n";
for(int i=1;i<=4;i++)
if(card[i])
cout<<"│"<<std::left<<setw(7)<<people[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ \n";
cout<<"╭───────╮ ╭───────╮ ╭───────╮ ╭───────╮ \n";
for(int i=5;i<=8;i++)
if(card[i])
cout<<"│"<<grade[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n";
cout<<"│ │ │ │ │ │ │ │ \n";
for(int i=5;i<=8;i++)
if(card[i]-1==1)
cout<<"│★ │ ";
else if(card[i]-1==2)
cout<<"│★★ │ ";
else if(card[i]-1==3)
cout<<"│★★★ │ ";
else if(card[i]-1==4)
cout<<"│★★★★ │ ";
else if(card[i]-1>=5)
cout<<"│★★★★★ │ ";
else
cout<<"│ │ ";
cout<<"\n";
for(int i=5;i<=8;i++)
if(card[i])
cout<<"│"<<std::left<<setw(7)<<people[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n╰───────╯ ╰───────╯ ╰───────╯ ╰───────╯ \n";
cout<<"你现在要干什么\n1.上课(可获得随机名片) 2.抽卡 3.日志(最多保存10000条, 於海洋开发) 4.退出\n";
cin>>input;
if(input=="1"){
int ck=rand()%7+-2;
if(sk-ck<0)
ck=rand()%5+1;
sk+=ck;
if(ck>0){
cout<<"你上表现较好, 老师奖励了你";
cout<<ck<<"个名片\n";
rizhi[rzcnt+1]="老师奖励"+tostr(ck)+"个名片";
}
else if(ck<0){
cout<<"你上课表现较差, 老师扣了你";
cout<<abs(ck)<<"个名片\n";
ck=abs(ck);
rizhi[rzcnt+1]="老师扣除"+tostr(ck)+"个名片";
}
else{
cout<<"你上课啥都没干\n";
rizhi[rzcnt+1]="啥也没干";
}
Sleep(500);
rzcnt++;
if(rzcnt==10001){
rzcnt==10000;
for(int i=2;i<=10001;i++){
rizhi[i-1]=rizhi[i];
}
}
system("pause");
}
else if(input=="2"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"╭────╭────╭────╭────╭────╭────╭────╭───────╮\n";
for(int i=1;i<=4;i++)
cout<<"│ │ │ │ │ │ │ │ │\n";
cout<<"╰────╰────╰────╰────╰────╰────╰────╰───────╯\n";
cout<<"\n\n\n\n\n\n\n\n";
cout<<"输入卡牌序号, 表示你所抽的卡牌\n";
cout<<"范围: 1~8\n";
cout<<" □×6 抽取\n";
cin>>input1;
rk=rand()%8+1;
if(input1<1 || input1>8){
cout<<" 无法抽取, 没有这张卡\n";
rizhi[rzcnt+1]="抽卡错误, 未选择范围内卡片";
}
else if(sk>=6 && card[rk]==0){
cout<<"你抽到了卡牌 "<<people[rk]<<" \n";
card[rk]++;
sk-=6;
rizhi[rzcnt+1]="抽到(新卡) "+people[rk];
}
else if(sk>=6 && card[rk]>0){
cout<<"你的卡牌 "<<people[rk]<<" 加了一颗星\n";
card[rk]++;
sk-=6;
rizhi[rzcnt+1]="抽到(+一颗星) "+people[rk];
}
else{
cout<<" 无法抽取, 名片不足\n";
rizhi[rzcnt+1]="无法抽取, 名片不足";
}
Sleep(500);
rzcnt++;
if(rzcnt==10001){
rzcnt==10000;
for(int i=2;i<=10001;i++){
rizhi[i-1]=rizhi[i];
}
}
system("pause");
}
else if(input=="3"){
for(int i=1;i<=rzcnt;i++){
cout<<i<<"."<<rizhi[i]<<endl;
}
system("pause");
}
else if(input=="4"){
cout<<"防误触! ";
cout<<"真的要退出吗? (输入 是 或 否) \n";
cin>>input;
if(input=="是")
return 0;
}
}
return 0;
}
周少平在2024-11-18 13:10:48追加了内容
有问题的试一下这个
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int input1,rk,sk=0;
int card[9];
string grade[9]={""," \\\\ A // "," \\\\ A // "," \\\\ A // "," \\\\ S // "," \\\\ A // "," \\\\ A // "," \\\\ S // "," \\\\SSR// "},people[9]={"","羊大婶","菲菲","沐沐","BUG狼","小程","小呆","布丁","酷丁猫"},input;
string rizhi[10005];
int rzcnt;
string tostr(int x){
stringstream ss;
ss<<x;
string ans;
ss>>ans;
return ans;
}
int main(){
system("title 酷丁名人堂 v2.0");
::MessageBox(NULL, TEXT(" 请调为全屏, 否则可能会有贴图bug!\n 别问为什么, 说多了都是泪(doge)"), TEXT("温馨提示"), 0);
while(true){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n 酷丁名人堂 ";
cout<<"\n □×"<<sk<<endl;
cout<<"─────────────────────────────────────────────────────────────\n";
cout<<"╭───────────╮ ╭───────────╮ ╭───────────╮ ╭───────────╮ \n";
for(int i=1;i<=4;i++)
if(card[i])
cout<<"│"<<grade[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n│ │ │ │ │ │ │ │ \n│ │ │ │ │ │ │ │ \n│ │ │ │ │ │ │ │ \n";
for(int i=1;i<=4;i++)
if(card[i]-1==1)
cout<<"│★ │ ";
else if(card[i]-1==2)
cout<<"│★★ │ ";
else if(card[i]-1==3)
cout<<"│★★★ │ ";
else if(card[i]-1==4)
cout<<"│★★★★ │ ";
else if(card[i]-1>=5)
cout<<"│★★★★★ │ ";
else
cout<<"│ │ ";
cout<<"\n";
for(int i=1;i<=4;i++)
if(card[i])
cout<<"│"<<std::left<<setw(11)<<people[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n╰───────────╯ ╰───────────╯ ╰───────────╯ ╰───────────╯ \n";
cout<<"╭───────────╮ ╭───────────╮ ╭───────────╮ ╭───────────╮ \n";
for(int i=5;i<=8;i++)
if(card[i])
cout<<"│"<<grade[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n";
cout<<"│ │ │ │ │ │ │ │ \n│ │ │ │ │ │ │ │ \n│ │ │ │ │ │ │ │ \n";
for(int i=5;i<=8;i++)
if(card[i]-1==1)
cout<<"│★ │ ";
else if(card[i]-1==2)
cout<<"│★★ │ ";
else if(card[i]-1==3)
cout<<"│★★★ │ ";
else if(card[i]-1==4)
cout<<"│★★★★ │ ";
else if(card[i]-1>=5)
cout<<"│★★★★★ │ ";
else
cout<<"│ │ ";
cout<<"\n";
for(int i=5;i<=8;i++)
if(card[i])
cout<<"│"<<std::left<<setw(11)<<people[i]<<"│ ";
else
cout<<"│ │ ";
cout<<"\n╰───────────╯ ╰───────────╯ ╰───────────╯ ╰───────────╯ \n";
cout<<"你现在要干什么\n1.上课(可获得随机名片) 2.抽卡 3.日志(最多保存10000条, 於海洋开发) 4.退出\n";
cin>>input;
if(input=="1"){
int ck=rand()%7+-2;
if(sk-ck<0)
ck=rand()%5+1;
sk+=ck;
if(ck>0){
cout<<"你上表现较好, 老师奖励了你";
cout<<ck<<"个名片\n";
rizhi[rzcnt+1]="老师奖励"+tostr(ck)+"个名片";
}
else if(ck<0){
cout<<"你上课表现较差, 老师扣了你";
cout<<abs(ck)<<"个名片\n";
ck=abs(ck);
rizhi[rzcnt+1]="老师扣除"+tostr(ck)+"个名片";
}
else{
cout<<"你上课啥都没干\n";
rizhi[rzcnt+1]="啥也没干";
}
Sleep(500);
rzcnt++;
if(rzcnt==10001){
rzcnt==10000;
for(int i=2;i<=10001;i++){
rizhi[i-1]=rizhi[i];
}
}
system("pause");
}
else if(input=="2"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"╭────╭────╭────╭────╭────╭────╭────╭───────╮\n";
for(int i=1;i<=4;i++)
cout<<"│ │ │ │ │ │ │ │ │\n";
cout<<"╰────╰────╰────╰────╰────╰────╰────╰───────╯\n";
cout<<"\n\n\n\n\n\n\n\n";
cout<<"输入卡牌序号, 表示你所抽的卡牌\n";
cout<<"范围: 1~8\n";
cout<<" □×6 抽取\n";
cin>>input1;
rk=rand()%8+1;
if(input1<1 || input1>8){
cout<<" 无法抽取, 没有这张卡\n";
rizhi[rzcnt+1]="抽卡错误, 未选择范围内卡片";
}
else if(sk>=6 && card[rk]==0){
cout<<"你抽到了卡牌 "<<people[rk]<<" \n";
card[rk]++;
sk-=6;
rizhi[rzcnt+1]="抽到(新卡) "+people[rk];
}
else if(sk>=6 && card[rk]>0){
cout<<"你的卡牌 "<<people[rk]<<" 加了一颗星\n";
card[rk]++;
sk-=6;
rizhi[rzcnt+1]="抽到(+一颗星) "+people[rk];
}
else{
cout<<" 无法抽取, 名片不足\n";
rizhi[rzcnt+1]="无法抽取, 名片不足";
}
Sleep(500);
rzcnt++;
if(rzcnt==10001){
rzcnt==10000;
for(int i=2;i<=10001;i++){
rizhi[i-1]=rizhi[i];
}
}
system("pause");
}
else if(input=="3"){
for(int i=1;i<=rzcnt;i++){
cout<<i<<"."<<rizhi[i]<<endl;
}
system("pause");
}
else if(input=="4"){
cout<<"防误触! \n";
cout<<" 真的要退出吗? (输入 是 或 否) \n";
cin>>input;
if(input=="是")
return 0;
}
}
return 0;
}