Question: Using C programming: Write a function to add extra blanks to the left end of a string to make it at least length n. If

Using C programming:

  1. Write a function to add extra blanks to the left end of a string to make it at least length n. If the string is already n characters or longer, do not change the string. Assume the prototype is
     void padLeft(char a[], int n);
  2. Write a function to center a string by adding blanks to the front and back. If the string is already n characters or longer, do not change the string. If an odd number of blanks have to be added, put the extra blank on the right. You can use the functions in the previous problems (padRight and padLeft) to solve this problem. Assume the prototype is
     void center(char a[], int n);
  3. Write a function which shortens a string to n characters. If the string is already shorter than n, the function should not change the string. Assume the prototype is
     void truncate(char a[], int n);
  4. Write a function which capitalizes the first letter in every word. Assume the first letter is any letter at the beginning or preceded by a blank. All other letters should be turned into lowercase. You can use the library toupper and tolower functions. Assume the prototype is
     void capitalizeWords(char a[]);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!