Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

string

Posted on 1999-01-08
3
Medium Priority
?
203 Views
Last Modified: 2010-04-15
write functions to (a) left justify , (b)right justify ,(c) center justify agiven string. Test the fuctions with 5 strings
0
Comment
Question by:samuelccs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:scrapdog
ID: 1255637
Post the code you have so far.
0
 
LVL 8

Accepted Solution

by:
jhurst earned 60 total points
ID: 1255638
when I saw the previous question from you I thought that it may just be a coincidence that something I had set in class turned up.  Now that I see all the assignments here I am much more suspicious.
0
 

Expert Comment

by:rsongyl
ID: 1255639
Easily done

Tip: See the size of your string and then do calculation when a string is entered.

For right justification ... you just use the puts() command
For Left, use strlen() function to count your input string. Use the array size minus the strlen(input_string). Get the result and start from that index.
For centre, use the % the input string by 2. Then take the remainder minus from %2 of index. Start from the
index[(%2index-remainder)].
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question