I been trying to make a simple timer that counts down in seconds.
When I get under ten the numbers go like this.
12
11
10
90
80
how do I get rid of the zero on the end?
Last edited on
Post your code, and we'll be able to see the problem.
<< right << ...
[edit]
For example:
1 2 3 4 5 6 7 8 9 10
|
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
cout << setfill( '0' ) << setw( 2 ) << left << 7 << endl;
cout << setfill( '0' ) << setw( 2 ) << right << 7 << endl;
return 0;
}
|
70
07 |
Hope this helps.
Last edited on
Is there a fast way to do it from numbers 1 till 9?