variable is ambiguous | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

variable is ambiguous

https://code.sololearn.com/ccinhk7Wi6SV/?ref=app I'm trying to stop the while loop if "end" is equal to 1. If the goblin and ninja die, end is now equal to 1 (ending the loop). I'm trying to implement this but it keeps saying "end is ambiguous". How do I fix this? Sorry if the code is too long, it's a big one. Check out line 180 and line 29 for my problem.

26th Jun 2020, 9:48 PM
Clueless Coder
Clueless Coder - avatar
2 Answers
+ 2
In namespace std, there is a function std::end()... That's why it is ambiguous... Just assign it another name, like flagEnd...
26th Jun 2020, 9:55 PM
G B
G B - avatar
+ 3
This is why people strongly recommend to not use 'using namespace std;' :)
26th Jun 2020, 10:31 PM
Dennis
Dennis - avatar