Struggling with this im new to programming and strings confuse me?

Write a program that

1. reads in a single string entered from the keyboard in the form last_name,first_name with no embedded blanks. Note that a comma separates the two pieces. Have it store this input as a single string (NOTE THAT YOU DON’T HAVE TO READ THE STRING IN 1 CHAR AT A TIME,, BUT SHOULD READ IT IN ALL AT ONCE!)

2. NOW, break the string up and store the first_name and last_name separately as 2 separate strings.called FIRST and LAST (Have it capitalize the first letter of each if they are not already capitalized)

3. Have it print out each together with the number of characters in each.

4. Now have your program create a new string called THE_NAME that looks like first_name last_name (Note the blank between the first and last names) Have your program print out THE_NAME

Sample run (This should be printed twice):
Enter your name in the form last_name,first_name
Smith,john

Your first name is John and it contains 4 characters
Your last name is Smith and it contains 5 characters

Your full name is John Smith

Use the old C string way to solve it. That is, use and array of char with ‘’ marking the end of the string.

Any Help would be much appreciated!!

✅ Answers

? Best Answer

  • Using strings in C: http://www.cprogramming.com/tutorial/les…
  • Leave a Comment