Submission #15666

#TimeUsernameProblemLanguageResultExecution timeMemory
15666onemonster님 무기가 좀 나쁘시네여 (kriii3_S)C++98
Compilation error
0 ms0 KiB
class Player { private: int Attack; int Power; int CritChance; int CritDamage; int AttackSpeed; int BattleScore; bool isEquiped=true; public: Player(int Atk,int Pwr,int CrtChc,int CD,int AtkSpd) { if(Atk<0 || Atk>20000 || Pwr<0 || Pwr>20000 || CrtChc<0 || CrtChc>200 || CD<0 || CD>500 || AtkSpd <0 || AtkSpd>500) { cout<<"Could not initialize Player"; return; } Attack=Atk; Power=Pwr; CritChance=CrtChc; CritDamage=CD; AttackSpeed=AtkSpd; BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed); } void Equip(Weapon weapon) { isEquiped=true; Attack+=weapon.Attack; Power+=weapon.Power; CritChance+=weapon.CritChance; CritDamage+=weapon.CritDamage; AttackSpeed+=weapon.AttackSpeed; BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed); } void deEquip(Weapon weapon) { isEquiped=false; Attack-=weapon.Attack; Power-=weapon.Power; CritChance-=weapon.CritChance; CritDamage-=weapon.CritDamage; AttackSpeed-=weapon.AttackSpeed; BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed); } int GetBattleScore(void) { return BattleScore; } void ShowBattleScore(void) { cout<<BattleScore; } }; int main(void) { int a[20]; for(int i=0;i<20;i++) { cin>>a[i]; } Player Cree(a[0],a[1],a[2],a[3],a[4]);//Cree with weapon Player Paboo(a[5],a[6],a[7],a[8],a[9]);//Paboo with weapon Weapon CreeWeapon(a[10],a[11],a[12],a[13],a[14]); Weapon PabooWeapon(a[15],a[16],a[17],a[18],a[19]); int InitCreeBattleScore=Cree.GetBattleScore(); int InitPabooBattleScore=Paboo.GetBattleScore(); Cree.deEquip(CreeWeapon); Cree.Equip(PabooWeapon); Paboo.deEquip(PabooWeapon); Paboo.Equip(CreeWeapon); Compare(InitCreeBattleScore,Cree.GetBattleScore()); Compare(InitPabooBattleScore,Paboo.GetBattleScore()); return 0; }

Compilation message (stderr)

relay.cpp:10:20: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
     bool isEquiped=true;
                    ^
relay.cpp:26:16: error: ‘Weapon’ has not been declared
     void Equip(Weapon weapon)
                ^
relay.cpp:37:18: error: ‘Weapon’ has not been declared
     void deEquip(Weapon weapon)
                  ^
relay.cpp: In constructor ‘Player::Player(int, int, int, int, int)’:
relay.cpp:16:13: error: ‘cout’ was not declared in this scope
             cout<<"Could not initialize Player";
             ^
relay.cpp:24:62: error: ‘min’ was not declared in this scope
         BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed);
                                                              ^
relay.cpp: In member function ‘void Player::Equip(int)’:
relay.cpp:29:24: error: request for member ‘Attack’ in ‘weapon’, which is of non-class type ‘int’
         Attack+=weapon.Attack;
                        ^
relay.cpp:30:23: error: request for member ‘Power’ in ‘weapon’, which is of non-class type ‘int’
         Power+=weapon.Power;
                       ^
relay.cpp:31:28: error: request for member ‘CritChance’ in ‘weapon’, which is of non-class type ‘int’
         CritChance+=weapon.CritChance;
                            ^
relay.cpp:32:28: error: request for member ‘CritDamage’ in ‘weapon’, which is of non-class type ‘int’
         CritDamage+=weapon.CritDamage;
                            ^
relay.cpp:33:29: error: request for member ‘AttackSpeed’ in ‘weapon’, which is of non-class type ‘int’
         AttackSpeed+=weapon.AttackSpeed;
                             ^
relay.cpp:34:62: error: ‘min’ was not declared in this scope
         BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed);
                                                              ^
relay.cpp: In member function ‘void Player::deEquip(int)’:
relay.cpp:40:24: error: request for member ‘Attack’ in ‘weapon’, which is of non-class type ‘int’
         Attack-=weapon.Attack;
                        ^
relay.cpp:41:23: error: request for member ‘Power’ in ‘weapon’, which is of non-class type ‘int’
         Power-=weapon.Power;
                       ^
relay.cpp:42:28: error: request for member ‘CritChance’ in ‘weapon’, which is of non-class type ‘int’
         CritChance-=weapon.CritChance;
                            ^
relay.cpp:43:28: error: request for member ‘CritDamage’ in ‘weapon’, which is of non-class type ‘int’
         CritDamage-=weapon.CritDamage;
                            ^
relay.cpp:44:29: error: request for member ‘AttackSpeed’ in ‘weapon’, which is of non-class type ‘int’
         AttackSpeed-=weapon.AttackSpeed;
                             ^
relay.cpp:45:62: error: ‘min’ was not declared in this scope
         BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed);
                                                              ^
relay.cpp: In member function ‘void Player::ShowBattleScore()’:
relay.cpp:53:9: error: ‘cout’ was not declared in this scope
         cout<<BattleScore;
         ^
relay.cpp: In function ‘int main()’:
relay.cpp:62:9: error: ‘cin’ was not declared in this scope
         cin>>a[i];
         ^
relay.cpp:66:5: error: ‘Weapon’ was not declared in this scope
     Weapon CreeWeapon(a[10],a[11],a[12],a[13],a[14]);
     ^
relay.cpp:67:12: error: expected ‘;’ before ‘PabooWeapon’
     Weapon PabooWeapon(a[15],a[16],a[17],a[18],a[19]);
            ^
relay.cpp:70:18: error: ‘CreeWeapon’ was not declared in this scope
     Cree.deEquip(CreeWeapon);
                  ^
relay.cpp:71:16: error: ‘PabooWeapon’ was not declared in this scope
     Cree.Equip(PabooWeapon);
                ^
relay.cpp:74:54: error: ‘Compare’ was not declared in this scope
     Compare(InitCreeBattleScore,Cree.GetBattleScore());
                                                      ^