Computers and Technology

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, and ` (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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:00, Siebee23
This program will store roster and rating information for a soccer team. coaches rate players during tryouts to ensure a balanced team. (1) prompt the user to input five pairs of numbers: a player's jersey number (0 - 99) and the player's rating (1 - 9). store the jersey numbers in one int vector and the ratings in another int vector. output these vectors (i. e., output the roster). (3 pts) ex: enter player 1's jersey number: 84 enter player 1's rating: 7 enter player 2's jersey number: 23 enter player 2's rating: 4 enter player 3's jersey number: 4 enter player 3's rating: 5 enter player 4's jersey number: 30 enter player 4's rating: 2
Answers: 1
image
Computers and Technology, 22.06.2019 08:10, josued123321
Alook-up table used to convert pixel values to output values on a monitor. essentially, all pixels with a value of 190 or above are shown as white (i. e. 255), and all values with a value of 63 or less are shown as black (i. e. 0). in between the pixels are scaled so that a pixel with a value p is converted to a pixel of value 2/127 −+3969). if a pixel has a value of 170 originally, what value will be used to display the pixel on the monitor? if a value of 110 is used to display the pixel on the monitor, what was the original value of the pixel?
Answers: 1
image
Computers and Technology, 22.06.2019 09:50, shadow29916
What is a rush associated with alcohol?
Answers: 1
image
Computers and Technology, 22.06.2019 11:40, silviamgarcia
Pthreads programming: create and terminate a thread write a c++ program that creates a thread. the main will display a message “hello world from the main”. the main will create a thread that will display a message “hello world from the thread” and then terminates with a call to pthread_exit()
Answers: 3
Do you know the correct answer?
In the written Hawaiian language, only 13 letters are used: the five vowels (a, e,i, o, and u), and...

Questions in other subjects:

Konu
World Languages, 20.03.2021 17:40
Konu
English, 20.03.2021 17:40