Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

>> C code please according to instructions. ONLY C code. < < Q1. Write a C function with the following prototype: void spacesToXs(char *s) This

>> C code please according to instructions. ONLY C code. << Q1. Write a C function with the following prototype: void spacesToXs(char *s) This function replaces ALL space characters in the string 's' with the character 'X' (capital X). See the examples below: original string: altered string: "j a w s" "jXaXwXs" " " "XXXX" "are you ok X?" "areXyouXokXX?" Q2. Write a C function with the following prototype: unsigned int howManyVowels(const char *s) That determines how many vowels (alphabetic letters 'a', 'e', 'i', 'o', or 'u') UPPER or lowercase are contained in the string 's'. Once complete, the function returns the total number of vowels found or the value 0 if no vowels are found. For example, string: return value: "123-xyz" 0 "This is PRG355@SENECA" 5 Q3. Write a C function with the following prototype: void mirrorImage(char *s) that accepts a string 's' containing at least 4 characters and reverses the order of the characters in each half of the string. For example, original string: altered string: "123456789" "432159876" "hello world" "olleh dlrow" "even" "vene" MAIN PROGRAM: // Your solution may ONLY use functions from the following // included C library header files. #include  #include  #include  // function prototypes: void spacesToXs(char *s); unsigned int howManyVowels(const char *s); void mirrorImage(char *s); int main( ) { int i; unsigned int rv; char words1[3][31] = { "j a w s", " ", "are you OK X?" }; char words2[2][81] = { "123-xyz", "This is PRG355@SENECA" }; char images[3][31] = { "123456789", "hello world", "even" }; for(i=0; i<3; i++) { spacesToXs(words1[i]); printf("'%s' ", words1[i]); } for(i=0; i<2; i++) { rv = howManyVowels(words2[i]); printf("%u ", rv); } for(i=0; i<3; i++) { mirrorImage(images[i]); printf("%s ", images[i]); } return 0; } /* CORRECT OUTPUT: 'jXaXwXs' 'XXXX' 'areXyouXOKXX?' 0 5 432159876 olleh dlrow vene */

// You may add your own helper functions or symbolic constants here. // Functions that you add to this code MUST also be prototyped here. void spacesToXs(char *s) { // your code here ... } unsigned int howManyVowels(const char *s) { // your code here ... } void mirrorImage(char *s) { // your code here ... }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions