我只是一個初學者在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
我不知道爲什麼我收到此錯誤的。
`
嗯......有什麼錯誤? –