我是 C++ 编码新手,我想制作一个简单的口袋妖怪游戏。
我在头文件中创建了一个类,并在单独的文件中定义函数.cpp。
我还有一个主文件,我将在其中运行我的实际代码。
所以我std::string在函数文件中定义了一个函数,它说std是一个未声明的标识符。
这是我的每个文件:
函数定义:
#include "fns.hpp"
int Pokemon::getHP() {
return hp;
}
int Pokemon::getAttack() {
return attack;
}
int Pokemon::getDefense() {
return defense;
}
int Pokemon::getSpecialAttack() {
return specialAttack;
}
int Pokemon::getSpecialDefense() {
return specialDefense;
}
int Pokemon::getSpeed() {
return speed;
}
std::string Pokemon::getAttack1() {
return attack1;
}
std::string Pokemon::getAttack2() {
return attack2;
}
std::string Pokemon::getAttack3() {
return attack3;
}
std::string Pokemon::getAttack4() {
return attack4;
}
Pokemon::Pokemon(int qhp,int qdefense,int qattack,int …Run Code Online (Sandbox Code Playgroud)