进来看看
2026-02-04 17:37:30
发布于:上海
有人能把这个代码改对吗?
#include<iostream>
#include<ctime>
#include<string>
#include<windows.h>
#include<cstdio>
#include<cmath>
#include<fstream>
using namespace std;
int x=100, coin=100, buy_time, bt[1010], cd_=0,buy[1010], kill_=0, player=0, game=0;
string name[5]={"花似雪","N","N"}, gname, shop[10]={"血量(10血)","血量(20血)","血量(30血)","血量(50血)","缩短CD 1秒","缩短CD 2秒","伤害(1血)","伤害(2血)","角色(一只姜)","角色(Macw07)"};
bool isKeyPressed(int key) {
return (GetAsyncKeyState(key)&0x8000)!=0;
}
int main(){
srand(static_cast<unsigned int>(time(0)));
int n, ox=rand()%50+x-10, j=x,kill,choice, f=0, m_kill=0,f2=0;
string g;
double p=0, p1=0, p2=0, p3=0;
system("cls");
cout << "是否参加新手教程\n(只应许使用英雄 花似雪)\n1.是 2.否\n";
cin >> n;
if(n==1){
system("cls");
cout << "新手引导:\n请按下 1 键使用普攻\n";
while(true){
if (isKeyPressed('1')) {
cout<<"我方使用普攻,造成了敌方1点伤害"<<endl;
break;
}
}
cout << "请按下 2 键使用一技能\n";
while(true){
if (isKeyPressed('2')) {
if(player==0){
cout << "我方使用一技能 滔滔火海,造成了敌方"<<10+kill_<<"点伤害"<<endl;
}
break;
}
}
cout << "请按下 3 键使用二技能\n";
while(true){
if (isKeyPressed('3')) {
if(player==0){
cout << "我方使用二技能 暴力破解,造成了敌方"<<12+kill_<<"点伤害"<<endl;
}
break;
}
}
cout << "请按下 4 键使用大招\n";
while(true){
if (isKeyPressed('4')) {
if(player==0){
cout << "我方使用大招 水来土掩,造成了敌方"<<20+kill_<<"点伤害"<<endl;
}
break;
}
}
system("pause");
}
system("cls");
while(true){
cout << "请选择出战角色:\n1.花似雪 2.一只姜 3.Macw07\n";
cin >> choice;
if(choice==1){
gname = "花似雪";
player = 0;
break;
}
else if(choice==2&&name[1]=="一只姜"){
gname = "一只姜";
player = 1;
break;
}
else if(choice==3&&name[2]=="Macw07"){
gname = "Macw07";
player = 2;
break;
}
cout<<"你没有这个角色。\n";
}
cout << "你的角色为:" << gname << endl;
choice = rand()%3;
cout << "敌方的角色为:";
if(choice==0) cout << "法兰西玫瑰\n";
else if(choice==1) cout << "复仇者_黑客_ZDZL\n";
else if(choice==2) cout << "陈臻武\n";
system("pause");
}
全部评论 2
不能
2026-02-05 来自 上海
1发灌水
2026-02-05 来自 浙江
0






























有帮助,赞一个