No operators match these operands | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

No operators match these operands

i get this error under the <= signs and idk why please help https://code.sololearn.com/cs3iCShS4FYH/?ref=app

26th Apr 2018, 7:45 PM
Nislo Mislo
Nislo Mislo - avatar
9 Answers
+ 3
after struct name you should not use () https://code.sololearn.com/cq0KMr71Acof/?ref=app
26th Apr 2018, 8:47 PM
🇮🇷 M N
+ 3
you have to return 0 at the end. also your if statement is wrong. the condition must be health.health . player(health) is wrong
26th Apr 2018, 9:03 PM
sajede mirzaei
sajede mirzaei - avatar
+ 3
define more players like this: player p1; player p2; player p3; and if you have many players use array: player players[100];
27th Apr 2018, 6:46 AM
🇮🇷 M N
+ 2
thank you
27th Apr 2018, 8:15 PM
Nislo Mislo
Nislo Mislo - avatar
+ 1
you can access each player's health with itsName.health. for example p2.health
27th Apr 2018, 8:14 PM
sajede mirzaei
sajede mirzaei - avatar
+ 1
so you have to specify the index. player[2].health
27th Apr 2018, 8:22 PM
sajede mirzaei
sajede mirzaei - avatar
0
but what if i have more then one plauer
27th Apr 2018, 6:38 AM
Nislo Mislo
Nislo Mislo - avatar
0
how do i define which player takes damage and subtract that players health?
27th Apr 2018, 5:33 PM
Nislo Mislo
Nislo Mislo - avatar
0
what if i make an array of players?
27th Apr 2018, 8:15 PM
Nislo Mislo
Nislo Mislo - avatar