Compilation error [C++] | Sololearn: Learn to code for FREE!


Compilation error [C++]

I'm getting compilation error in my program. Please don't use the technical words bcz I'm just new in c++.πŸ˜„

2/16/2019 8:33:59 AM

Ayush Sinha

2 Answers

New Answer


In addition to the comments of Anna , your AttackingZombie function is already doing some printing and does not have a return value (as it is void). So you do not need another cout in the main function, just call the function plainly.


Line 23: "apowet" => "apower" Line 18: the method getpower() cannot access the parameter "apower" that was passed to the constructor. The instance variable is called "power" Line 22 etc.: if(apower == (int)) looks wrong to me, but I'm bad with C++. Probably need to replace it with something like if(typeid(apower) == typeid(int())) Line 54: "intbaaccuracy"? Probably not. Make sure to remove all spelling errors. The compiler won't guess what you mean