Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c programming Write a program that can find the length of a string, find the number of words, copy a string, and capitalize the copied
c programming
Write a program that can find the length of a string, find the number of words, copy a string, and capitalize the copied string. Your program will not take any arguments. Instead, we will pass in the string using a built- in function called gets int main(int argc, char **argv) char string[ 100]; char string2[1001 // get the input string printf("Enter string: gets (string): gets will take a line of input from the user and the resulting characters will be put in the string array You can find the number of words by counting spaces. You can check if a character is a space by checking if it is equal to 0x20 (the ASCII code for space) or comparing it with You will need to handle the case where the user pet multiple spaces between words. That should not count as multiple words. For the string copy, copy the characters from the original string and put it into string2. Make sure you terminate the new string2with a 0 The program results should look like: s./string Enter string: This is my string The length of the string is 17 The number of words is 4 The capitalized string is THIS IS MY STRING The original string is This is my string Make sure you print the original string after the capitalized string, so that you know the string copy workedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started