Is there a way to take a series of zeros as an int input?<>
This question already has an answer here:
- Find the reverse of a number (ex : 2500 reverse 0025) without the help of string or character 4 answers
"Three". "3". "Threeeeeeeeeeeeeeeeee". "03". "003". "0003". "00000000000000003". "III". "٣". "11". "३". "三". "Γʹ".
What do all the above things have in common? They're all representations of the number three†. Are the representations different? Yes. Are the numbers they represent different? No. There is only one number three.
The number three is indistinguishable from the number three as there is only one number three. However, two representations of the number three may be distinct from each other, since they may use different symbols, or different rules for bringing the symbols together.
ints in C++ (and in pretty much every language with a similar data type) are used to handle numbers. So, if you assign the number three to a variable of such a type, you get the number three. You don't get any particular representation of it. It's the number three. You get a representation of it when you ask for one, like when you output it.
So, how do you tell the difference between "3" and "0003" if they represent the same number? Easy: you don't use numbers.
The fundamental problem here is that you think you are dealing with numbers, but aren't. You are concerned with the representations, not the numbers themselves. So you should use a data type that can handle representations instead of one that can handle numbers. I believe the simplest solution is to use std::string.
† In order: English, base ten with Indo-Arabic numerals, English with extraneous "e"s to imply a longer final sound in speech, base eight in C notation, base eight in C# notation with an additional redundant zero, base eighty-seven with Indo-Arabic numerals and three redundant zeros, base thirty with Indo-Arabic numerals and twelve redundant zeros, Roman numerals, Eastern Arabic numerals, base two with Indo-Arabic numerals, Devanagari numerals, Chinese numerals, and Greek numerals.