if you have an int, say 34 and you want it to print out .000034 (withouit it saying 3.4e-6). What do you do?
Also, is there a way to print 000034 without the decimal?
thanks for your time people
if you have an int, say 34 and you want it to print out .000034 (withouit it saying 3.4e-6). What do you do?
Also, is there a way to print 000034 without the decimal?
thanks for your time people
for a standard amount of 0s
for a non- standard, use a int and a loop.Code:#include <iostream.h> #include <stdio.h> int main() { int x = 34; cout<<".0000"<<x; getchar(); return 0; }
Is this what you mean?
When you say "without the decimal", do you mean "without the dot"? 0.000034 without the decimal would be 0Code:int iVar=34; printf("%f", ((float)iVar/1000000));
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Thanks for your help guys.
To clarify, I mean't with leading zeros without the dot. (000034).
you can use ostream manipulators and flags like setw() and fill() to create 00034 from 34. They should be explained in your C++ text or in you compilers help section.