| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi all..i'm having a problem regarding c++ .
The problem is I need an integer of 4 digits 0000=<y=<9999 let y= 0192 but when i take cout<< y it gives me 192 only.. but i need to print y = 0192 how can i fix the digits of an integer number? urgently needed.. thankz.. regards shaer |
|
#2
|
|||
|
|||
|
Search google for info on the iomanip and conio libraries.
|
|
#3
|
|||
|
|||
|
#include <iostream>
#include <iomanip> int num = 603; cout<<setiosflags(ios_base::right); cout<<setfill('0')<<setw(4)<<num; try this out...hope its what your looking for. -jesse Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > if y=0192 how to print y=0192 by fixing int y to 4 digits..? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|