How to display any zeros in front?

How would I make the program still display zeros in front of a number?

Like say for example:

cout << "Enter any number";
cin >> number;

cout << number;

Let's say I entered 0003 as my input. How would I make it to where it will display the three zeros in front of the 3 instead of just displaying 3?

You may want to look into some of the stream output manipulators such as setfill() and setw().

Topic archived. No new replies allowed.