我只是一个初学者在c + +所以我只想做一个简单的程序。 但我遇到了很多麻烦。 请告诉我如何解决这个错误,因为我不太了解构造函数。我得到这个错误:隐式声明的定义
#include <iostream>
#include<windows.h>
#include<fstream>
using namespace std;
int main()
{
MessageBox(NULL,"YOU HAVE BEEN PROMOTED TO TEST THIS CONSOLE APP FOR FREE!!","PROMOTION!!",NULL);
cout << "Hello world!............ first do you want this program to changeyour files to save progress??" << endl;
int save;
cout << "press 1 to allow press 2 to deny!!"<<endl;
cin >> save;
if(save == 1){
ofstream myfile;
myfile.open ("data.txt");
}
if(save == 2);
cout<<"set up done!!!"<<endl;
return 0;
}
,这是我的老板
#ifndef BOSS_H
#define BOSS_H
class Boss
{
int boss_helth(){
int boss_helth0 = 200;
return boss_helth();
}
void Punch(){
}
};
类和最后我所有的播放器类
#ifndef PLAYER_H
#define PLAYER_H
class Player
{
int Player_helth(){
Player_helth0 = 200;
return player_helth0;
}
void patt(){
public:
int power_punch = - 20;
}
};
#endif // PLAYER_H
我不知道为什么我收到此错误的。
`
嗯......有什么错误? –