+ 2
Time limit exceeded?
I'm making a game using c++, and have made a little options menu, which as of now can only take and react on the prompt to attack. but after printing ("you did X damage"), I get a little message at the bottom saying: "time limit exceeded". can anyone help? I don't want this coming back to haunt me https://code.sololearn.com/czi6tS2Zx3w9/?ref=app
2 Respostas
+ 1
While Chirag is right, something else is at play.
What is causing the time limit exceeded is because your program crashes.
Your attack_o function should return a string but you never return a string, all you do is output something but that's not the same as returning.
cout << attack_o() << endl; then takes some garbage value that is interpreted as a string but because it's not a string it crashes.
+ 8
Sololearn won't allow your code to get executed for more than 5 seconds......
if it does so , it returns "Time Limit Exceeded"