Problem swords
User tuongphat2505
Submission Time 2025-02-15 16:45:44
Score 0
Max Time N/A
Max Memory N/A

Compile Error

swords.cpp:24:16: error: ‘Sword’ does not name a type
24 | bool cmp(const Sword &a, const Sword &b) {
| ^~~~~
swords.cpp:24:32: error: ‘Sword’ does not name a type
24 | bool cmp(const Sword &a, const Sword &b) {
| ^~~~~
swords.cpp: In function ‘bool cmp(const int&, const int&)’:
swords.cpp:25:11: error: request for member ‘attack’ in ‘a’, which is of non-class type ‘const int’
25 | if (a.attack == b.attack) return a.defense > b.defense;
| ^~~~~~
swords.cpp:25:23: error: request for member ‘attack’ in ‘b’, which is of non-class type ‘const int’
25 | if (a.attack == b.attack) return a.defense > b.defense;
| ^~~~~~
swords.cpp:25:40: error: request for member ‘defense’ in ‘a’, which is of non-class type ‘const int’
25 | if (a.attack == b.attack) return a.defense > b.defense;
|