Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Spacing in C
Index -> Programming, C -> C Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rar




PostPosted: Wed Sep 30, 2009 1:03 pm   Post subject: Spacing in C

In my assignment, I am required to space out the output so that it is neatly organized in columns.

I'm sure this is something that must be done frequently, so what is the best way to go about doing it? Friends of mine have been suggesting/
attempting just putting spaces/tabs in the code, but I haven't found this to be successful.
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Wed Sep 30, 2009 2:31 pm   Post subject: Re: Spacing in C

rar @ Wed Sep 30, 2009 1:03 pm wrote:
In my assignment, I am required to space out the output so that it is neatly organized in columns.

I'm sure this is something that must be done frequently, so what is the best way to go about doing it? Friends of mine have been suggesting/
attempting just putting spaces/tabs in the code, but I haven't found this to be successful.
Google for "man printf". There is a minimum field width you can set. As long as you set the field width to be sufficiently large, you will get columns. Also, check out the "-" you can add like "%-10s" to change between left and right justification.
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: