Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Continuing under the code for part 1.b, you are going to add code to test and then print each letter of your name IF the

Continuing under the code for part 1.b, you are going to add code to test and then print each letter of your name IF the letter is a consonant. For purposes of this part of the code, please use your name in English alphabet letters only. We are going to put your name in a string and then write conditional statements to check each letter of your name in the string.

If the letter being checked is a consonant, then we will print it, if not, we will skip it.

This part of the program will have a bunch of repeated chunks of code, i.e. a few lines of code that will look very much the same will be used over and over again for as many letters as you have in your name.

First declare a character array, a C string, that holds your name; i.e. create and initialize a string that holds your family name. (Again, make sure you are using a name with at least 6 letters in it.). Name this string variable fName. Using the function iscons (below), write a test for the first letter in fName, the oth element, to see if it is a consonant.

If iscons(fName[0]) returns a 1, then the letter at fName[0] is a consonant. If the function call returns a 0, then the letter is a vowel. Print each consonant and their Unicode code together as a pair on one line. After you have tested the first letter at location [O] (and printed or not), then write the same test for the second letter at location [1] and print that letter and its code if it is a consonant. Do this for all remaining letters.

This will give you multiple small blocks of code that look the same except for testing a different letter from fName. Each pair of consonants and Unicode codes should be on a separate line.

For this part of the assignment do NOT implement a loop. The code for the function iscons should be put at the bottom of the program after the closing curly brace in main. You will also need to put the line : int iscons (char ltr); above the beginning of the main function in order for C to correctly define iscons.

Copy this function iscons after your main routine in your.c file: Il tests whether it is a consonant in the English alphabet int iscons (char ltr) { ltr = tolower(ltr); // // be sure to #include if ((ltr == 'a') || (ltr 'e') || (ltr == 'i') IL (ltr == 'o') || 'o') || (ltr 'u')) return 0; return 1; } = == == Take one screenshot of the lines of code that implement these actions and take a 2nd screenshot of your output. NOTE: You'll now have the four lines of output from 1.a. and part 1.b, then the rows of letter, Unicode code combinations.

Rubric: {9 pts} Correct C code for test to determine if the current letter is a consonant {3 pts} Correct use of letter at each location fName[#] to test (1 pts} Correct C code to print one letter and one ASCII code on each line of a table making two columns {3} Output screenshot(s) show correct information {2 pts} Example output (showing only the new output lines added.

This is not the entire required output) 80 P 80 h 104 h 104 114 114 115 115 t 116 116 r r S S t

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_2

Step: 3

blur-text-image_3

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

Pro Android Graphics

Authors: Wallace Jackson

1st Edition

1430257857, 978-1430257851

More Books

Students also viewed these Programming questions

Question

Be sensitive to and adapt to the diversity of your audience.

Answered: 1 week ago

Question

2. What are your biggest concerns about giving a speech in public?

Answered: 1 week ago