1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vanyuwa [196]
3 years ago
10

In the written Hawaiian language, only 13 letters are used: the five vowels (a,e,i,o, and u), and 8 consonants (h,k,l,m,n,p,w, a

nd ` (this backwards apostrophe is called an `okina, and is considered a consonant)). (Unfortunately, there is no easy way to write the kahako in ascii text). For this problem you should write two functions, int is_vowel(char); and int is_h_consonant(char); which are each given a character and return True or False. The function is_vowel() returns True is the character is a vowel (upper or lower case), and is_h_consonant() returns True if the character is a consonant (upper or lower case) in written Hawaiian.
You should write a simple (throw away) test driver to test your functions. Be sure you prompt the user (grader) of your test driver on what they should do to test your program. You should write this program in two files; driver1.c containing your test driver, and letters.c containing your functions. You should also have a file, letters.h, containing the prototypes and macros used in letters.c. I have provided a makefile for you in ~ee160/Homework/Hw3 which you can copy to your Hw3 directory. To compile this program, use the command:

make driver1
THIS IS WHAT I HAVE SO FAR:

LETTERS.C

#include"letters.h"

int is_vowel(char c){
return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}

int is_h_consonant(char c){
return c == 'H' || c == 'h' || c == 'K' || c == 'k' || c == 'L' || c == 'l' || c == 'M' || c == 'm' || c == 'N' || c == 'n' || c == 'P' || c == 'p' || c == 'W' || c == 'w';
}

LETTERS.H

int is_vowel(char);
int is_h_consonant(char);

DRIVER1.C

#include
#include"letters.h"

int main()
{
while(1)
{
int input;
//Asks the user to enter 1 or 2 to see if the letter is a consonant
//of vowel.
printf("Enter 1 to check vowel or 2 for consonant:");
//scans inputted number
scanf("%i", &input);
//if the input is 1 then it will ask the user to enter the letter
//they want to test.
if(input == 1)
{
char c;
printf("Enter a character to test if it's a vowel:");
c = getchar();
//if it is a vowel, then it will print that the letter is a vowel
if(is_vowel(c))
{
printf("%c is a vowel.\n", c);
}
//if not, then it will print that it isn't a vowel
else
{
printf("%c is not a vowel.\n", c);
}
}
{
//if the user inputs 2, then it will ask the user for the letter to test if
//it's a consonant or not.

if(input == 2)
{
char c;
printf("Enter a character to test if it's a consonant:");
c = getchar();
//if it is a consonant, then it will print that the letter is a consonant
if(is_h_consonant(c))
{
printf("%c is a consonant.\n", c);
}
//if not, then it will tell the user that it isn't a consonant
else{
printf("%c is not a consonant.\n", c);
}
}
else{
break;
}
}
}

return 0;
}

THIS IS WHAT I GET AS A SAMPLE OUTPUT:

Enter 1 to check vowel or 2 for consonant:2
Enter a character to test if it's a consonant:
is not a consonant.
Enter 1 to check vowel or 2 for consonant:1
Enter a character to test if it's a vowel:
is not a vowel.

Computers and Technology
1 answer:
Sergeu [11.5K]3 years ago
4 0

Answer:

see explaination

Explanation:

Code below:

#include"letters.h"

int main()

{

while(1)

{

int input;

//Asks the user to enter 1 or 2 to see if the letter is a consonant

//of vowel.

printf("Enter 1 to check vowel or 2 for consonant:");

//scans inputted number

scanf("%i", &input);

//if the input is 1 then it will ask the user to enter the letter

//they want to test.

if(input == 1)

{

char c;

printf("Enter a character to test if it's a vowel:");

scanf(" %c",&c);

//if it is a vowel, then it will print that the letter is a vowel

if(is_vowel(c))

{

printf("%c is a vowel.\n", c);

}

//if not, then it will print that it isn't a vowel

else

{

printf("%c is not a vowel.\n", c);

}

}

//if the user inputs 2, then it will ask the user for the letter to test if

//it's a consonant or not.

else if(input == 2)

{

char c;

printf("Enter a character to test if it's a consonant:");

scanf(" %c",&c);

//if it is a consonant, then it will print that the letter is a consonant

if(is_h_consonant(c))

{

printf("%c is a consonant.\n", c);

}

//if not, then it will tell the user that it isn't a consonant

else{

printf("%c is not a consonant.\n", c);

}

}

else{

break;

}

}

return 0;

}

See attachment for sample output

You might be interested in
Which of the following is true about images that are arranged in a collumn
makvit [3.9K]
Figure 1: An image — an array or a matrix of pixels arranged in columns and rows. In a (8-bit) greyscale image each picture element has an assigned intensity that ranges from 0 to 255. A grey scale image is what people normally call a black and white image, but the name emphasizes that such an image will also include many shades of grey. Figure 2: Each pixel has a value from 0 (black) to 255 (white). The possible range of the pixel values depend on the colour depth of the image, here 8 bit = 256 tones or greyscales. A normal greyscale image has 8 bit colour depth = 256 greyscales. A “true colour” image has 24 bit colour depth = 8 x 8 x 8 bits = 256 x 256 x 256 colours = ~16 million colours.
7 0
3 years ago
A set of programs that enable the hardware to process data is _____.
Mnenie [13.5K]
The most appropriate answer is C !! software os used for using hardware !!
4 0
3 years ago
HELP I WILL MARK BRAINLIEST!!! I NEED ASAP!!!
Alex777 [14]

#This is a way without a loop

friends = list(map(str,input("Enter Names: ").split()))

print(sorted(friends))

#This is a way with a loop (for&&while)

friends = list(map(str,input("Enter Names: ").split()))

cool = True

while cool:

   cool = False

   for i in range(len(friends)-1):

       if friends[i] > friends[i+1]:

           coo = friends[i]

           friends[i] = friends[i+1]

           friends[i+1] = coo

           cool = True

print(friends)

4 0
3 years ago
IT ethics are rules, policies, or principles that guide the behavior of IT professionals.
Vadim26 [7]

Answer: true

Explanation: true

6 0
3 years ago
Give 15 examples of copyright and trademarks that we come in contact with everyday. (Doesn't hve to be 15 could be 3 or 5) PLEAS
oksano4ka [1.4K]
Roads, trading, Government, water systems,
6 0
3 years ago
Other questions:
  • Directions Use your imagination and a word processor to write a business letter with two to three paragraphs. Your business lett
    5·1 answer
  • Please I need all the help I can get Thank You So Much
    14·1 answer
  • For an IP or device that is in the local network, it's a very straight forward cache table lookup for its MAC address. How does
    5·1 answer
  • Write an application that asks a user to type an even number or the sentinel value 999 to stop. When the user types an even numb
    8·2 answers
  • . Write a short program that asks the user to input a string, and then outputs the
    15·1 answer
  • Please help thank you !!!
    7·2 answers
  • 1. Which of the following cables are used in networking? Check all that apply.
    8·2 answers
  • KAPWING Video Editing Software allows you to use existing You Tube Videos in your design.
    8·1 answer
  • PLEASE HELP ASAP!! Timed test!!
    12·1 answer
  • Can anyone tell me about Microsoft some important features for partical
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!