I'd like to compare a few variables to see whether they match a certain number if strung together for example
Any help is greatly appriciated.Code:if (("%d%d%d", first, second, beg) == "2000");
I'd like to compare a few variables to see whether they match a certain number if strung together for example
Any help is greatly appriciated.Code:if (("%d%d%d", first, second, beg) == "2000");
One approach is to convert them to strings, concatenate the strings, then compare the final result to the other number as a string.
Another approach is to use mathematics: add the numbers up and compare. The limitation of course, is in the range of whatever type is used (and you have to either assume that the numbers are in the range [0,9] or it gets tricky).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)