cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Print Conversion Specifiers
Print Conversion Specifiers
Oct 4, 2013 at 10:31pm UTC
vFreeman
(35)
Hi ,
Is it possible to apply Print Conversion Specifiers to a single value multiple .
simply put ,
printf("%.1s%6lf\n", perimeter_Circle);
I want one digit precision and 7 tab space on this item.
thx.
Oct 4, 2013 at 11:32pm UTC
Duthomhas
(13130)
No. If you don't think it will work the way you want with a single specifier, use
sprintf()
to format the output to a string, then print the string with
printf()
.
I don't think you should have to do that, though. Why doesn't
printf(
"%*.1f\n"
, 7*TAB_SIZE, perimeter_Circle );
do the job?
BTW, "lf" is not a valid specifier. For
float
and
double
, use "f". If you are using
long double
, use "Lf".
Hope this helps.
Topic archived. No new replies allowed.