I'm trying to loop my entire program by encapsulating it in while true braces.
At the end of int main(), I reset all variables and vectors to 0.
The error I'm getting is "terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr"
I'm gathering from this that one of my statements that uses substr.() is stepping out of range, but I reset everything to zero so I'm not really sure why its stepping out of bounds. Any suggestions?
Works perfectly for me, but my compiler, after executing and looping it, says "This application has requested the Runtime to terminate in an unusual way.", then returns "3".
I would recommend declaring everything before starting the while loop.
Also, your program says "the string with the most characters is ", what does that mean? And if I put only 1 word and search that exactly word, the program crashes.
Well, I solved the problem of the program crashing on one word. Thanks for letting me know!
The program still terminates if I try to loop it continuously.
I thought it was generally considered bad form nowadays to declare everything at the head of the program. I read its best to declare variables closest to where you use them. I'm a newbie so I'm not sure, just what I read. If everything resets to 0 at the end, why would it step out of bounds?
the end of the code is just me resetting everything I can think of, but it still crashes T^T
There isn't any problems on declaring the variabels before the loop, declare everything there without values, assign the default values at the starting of the while loop and remove the value reset at the end of it. See if that works, maybe someone else will help you more.
PD: Does unsignedlongconst L = 18446744073709551615; work for you? My compiler gives me an error, maybe you did something wrong before posting it or my compiler is messed up...
yeah it works for me, I hope it doesn't work for me and only me lol. I posted another thread about that fix because it seemed unconventional, but it worked. Guess what I'm learning is it's only a local fix >.<