Please write your own original code. Objective Create a program that initializes and works with string variables. Create a program named LastnameFirstname15.c, that does the following: Note: There is no user input for this program. Declare and initialize a char array that stores your first name in title case. Title case means the first letter is uppercase and the rest is lowercase. Ensure the size/length of the array is equal to the length of your name plus the null character. As an example, my first name is Edward, therefore the size of the array will be 7. char firstname[7] = "Edward"; Declare and initialize another char array that stores your last name in title case. Ensure the size/length of the array is equal to the length of your name plus the null character. Use the strlen function to get the lengths of each name and store them in separate variables. Calculate the total length of your name by adding the lengths of the first name and last name and store it in another variable. Using the char arrays of your name, print your first and last name along with the lengths of each. Print the total length of your name. Ensure all of the output above is labeled appropriately. Loop through the first name array and print out each letter in lowercase on its own line in a staircase fashion. Staircase fashion means that starting from the second letter, output one space in front of the letter and increase the amount of space by 1 for each letter thereafter. In other words, the third letter should have 2 spaces in front, the fourth letter should have 3 spaces and so on. Hint: Use an inner for-loop to print out the spaces. To ensure the letters are all lowercase, use the tolower function. Loop backwards through the first name array and print out each letter in uppercase on its own line in reverse staircase fashion. Looping backwards means the loop starts at the last index of the array and goes down to index 0. Reverse staircase fashion means the amount of spaces is reversed from what it would be if looping forward. To ensure the letters are all uppercase, use the toupper function. Loop through the last name array and print out each letter in toggle case on its own line in a staircase fashion. Toggle case means the casing of the letter is continuously alternating between upper- and lowercase. To accomplish toggle case, print letters at even numbered indexes as uppercase and letters at odd numbered indexes as lowercase. The program should work for any name that is stored in the arrays. For example, if I change the first name to "Bananabanana" with array size 13, the program will still work without changing anything else.
Please write your own original code. Objective Create a program that initializes and works with string variables. Create a program named LastnameFirstname15.c, that does the following: Note: There is no user input for this program. Declare and initialize a char array that stores your first name in title case. Title case means the first letter is uppercase and the rest is lowercase. Ensure the size/length of the array is equal to the length of your name plus the null character. As an example, my first name is Edward, therefore the size of the array will be 7. char firstname[7] = "Edward"; Declare and initialize another char array that stores your last name in title case. Ensure the size/length of the array is equal to the length of your name plus the null character. Use the strlen function to get the lengths of each name and store them in separate variables. Calculate the total length of your name by adding the lengths of the first name and last name and store it in another variable. Using the char arrays of your name, print your first and last name along with the lengths of each. Print the total length of your name. Ensure all of the output above is labeled appropriately. Loop through the first name array and print out each letter in lowercase on its own line in a staircase fashion. Staircase fashion means that starting from the second letter, output one space in front of the letter and increase the amount of space by 1 for each letter thereafter. In other words, the third letter should have 2 spaces in front, the fourth letter should have 3 spaces and so on. Hint: Use an inner for-loop to print out the spaces. To ensure the letters are all lowercase, use the tolower function. Loop backwards through the first name array and print out each letter in uppercase on its own line in reverse staircase fashion. Looping backwards means the loop starts at the last index of the array and goes down to index 0. Reverse staircase fashion means the amount of spaces is reversed from what it would be if looping forward. To ensure the letters are all uppercase, use the toupper function. Loop through the last name array and print out each letter in toggle case on its own line in a staircase fashion. Toggle case means the casing of the letter is continuously alternating between upper- and lowercase. To accomplish toggle case, print letters at even numbered indexes as uppercase and letters at odd numbered indexes as lowercase. The program should work for any name that is stored in the arrays. For example, if I change the first name to "Bananabanana" with array size 13, the program will still work without changing anything else.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please write your own original code.
- Objective
- Create a
program that initializes and works with string variables.
- Create a
- Create a program named LastnameFirstname15.c, that does the following:
- Note: There is no user input for this program.
- Declare and initialize a char array that stores your first name in title case.
- Title case means the first letter is uppercase and the rest is lowercase.
- Ensure the size/length of the array is equal to the length of your name plus the null character.
As an example, my first name is Edward, therefore the size of the array will be 7.
char firstname[7] = "Edward"; - Declare and initialize another char array that stores your last name in title case. Ensure the size/length of the array is equal to the length of your name plus the null character.
- Use the strlen function to get the lengths of each name and store them in separate variables.
- Calculate the total length of your name by adding the lengths of the first name and last name and store it in another variable.
- Using the char arrays of your name, print your first and last name along with the lengths of each.
- Print the total length of your name.
- Ensure all of the output above is labeled appropriately.
- Loop through the first name array and print out each letter in lowercase on its own line in a staircase fashion.
- Staircase fashion means that starting from the second letter, output one space in front of the letter and increase the amount of space by 1 for each letter thereafter. In other words, the third letter should have 2 spaces in front, the fourth letter should have 3 spaces and so on.
- Hint: Use an inner for-loop to print out the spaces.
- To ensure the letters are all lowercase, use the tolower function.
- Loop backwards through the first name array and print out each letter in uppercase on its own line in reverse staircase fashion.
- Looping backwards means the loop starts at the last index of the array and goes down to index 0.
- Reverse staircase fashion means the amount of spaces is reversed from what it would be if looping forward.
- To ensure the letters are all uppercase, use the toupper function.
- Loop through the last name array and print out each letter in toggle case on its own line in a staircase fashion.
- Toggle case means the casing of the letter is continuously alternating between upper- and lowercase.
- To accomplish toggle case, print letters at even numbered indexes as uppercase and letters at odd numbered indexes as lowercase.
- The program should work for any name that is stored in the arrays. For example, if I change the first name to "Bananabanana" with array size 13, the program will still work without changing anything else.
Expert Solution
Step 1
C-INTRODUCTION:-
Early in the 1970s, the high-level programming language C was created. It was developed to be compiled using a reasonably straightforward compiler and was intended to be used as a system programming language.
The characteristics of both high-level and low-level languages are combined in C, which is regarded as a middle-level language.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education