C++ I/O
#include <iostream> #include <iomanip> using namespace std; int main() { cout << setfill('0') << setw(8) << 1234 << endl; }
int value=1234; int width = 8; printf ("%0*d \n", width, value);
#include <iostream> #include <iomanip> #include <conio.h> using namespace std; void main() { int m=4, n=8,input; cout<<"input a number by "<<m<<" digit:"<<endl; cin>>input; cout << setfill('0') << setw(n) << 1234 << endl;getch(); } </conio.h></iomanip></iostream>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)