I could be wrong, but shouldn't it print the same result as it is in string? What is the problem and how should I solve It?
2/15/2020 4:26:36 PM
Try using function stol. It converts a string to a long integer.
std::cout << std::stol(code) ;
Edit : you can do, if you want :
std::cout << atol(code.c_str())
The value you given is not in range of intiger.
Because of overflow, you are getting converted value..
Yes. Use stol(code) ;
I just seen now..
If you are using a long long to store the result then use stoll() not stol().
either that or use a long to store the value returned from stol().
Théophile Thanks for help :)
Jayakrishna maybe you know how to solve the problem?
Learn Playing. Play Learning
Send us a message