"expected } at end of input"

Ello, I'm trying to make a game, just for practice, but I got this error. The compiler says it is on line 59

//Battle game w/ random enemy stats
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

class enemy;

class mainChar {
friend class enemy;
int HP,POW;
string Name;
public:
int statChoose(){
cout<<"What is your name? ";
cin>>Name;
cout<<"Now choose HP(100 MAX) ";
cin>>HP;
if(HP>100){
HP=100;
}
cout<<"Finally, choose Power(100 Max, 70 Max if HP = 100) " << "\n";
cin>>POW;
if(HP>99||POW<70){
POW=70;
}else if(POW>100){
POW=100;
}
}
int statCheck(){
cout<<"Your name is "<< Name << "\n";
cout<<"Your HP is " << HP << "\n";
cout<<"and your power is " << POW<< "\n";
cout<<"Correct?";
}

};
class enemy{
int ENHP = rand() % 100 +1;
int ENPOW = rand() % 100 +1;
if(HP>99){
if(ENHP>95){
ENHP=95;
if(ENPOW>75){
ENPOW=75;
}
}
}

};


int main (void) {
mainChar guy1;
guy1.statChoose();
guy1.statCheck();
return 0;

}
You're trying to put conditionally executable code in the body of a class definition outside of a function (see: class enemy.) That results in a syntax error and likely is reported before the error you mention. Always take care of the first error that is reported before worrying about other ones. Errors following the first often occur as a cascade effect from the first.
Thank you.
Topic archived. No new replies allowed.