Thursday, July 9, 2009

In c programming language, when printing(ie printf), how do i align the data?

i have to do a program wherein it is necessary to align the data. it's like a table but without the lines. is there any function in c that will allow me to print in a particular value in a specified row and column area? using tabs wouldn't work because the data values have varying lengths thus ending up unaligned.

In c programming language, when printing(ie printf), how do i align the data?
Yea you can do it by using %+d and %-d. Just use them and see what happens.
Reply:You mean formatted output in c?


chek this or similar links maybe


http://www-ccs.ucsd.edu/c/lib_prin.html
Reply:Formatting the output can be done directly within that "%f %s \n..." portion, %.2f means output by 2 decimal places, but i really don't recall much from those, more than that you may need to create some intermediate string manipulation code to achieve what you want.

easter cards

No comments:

Post a Comment