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
What is the name of the FOLDER in which the file named "script" is contained?
yulyashka [42]

Answer:

The default location for local logon scripts is

  • the Systemroot\System32\Repl\Imports\Scripts folder

5 0
2 years ago
What is the purpose of the literature review section of research paper
navik [9.2K]

variation of colored sediment

5 0
3 years ago
3. Which of the following is a single piece of information related to the person, place,
stepan [7]
I think the answer is field
8 0
2 years ago
Read 2 more answers
A final class can't be extended.TrueFalse
PIT_PIT [208]

Answer:

True

Explanation:

A final class is something like sealed one and no one can inherit that further.

it is useful to lock our code or functionality from others

4 0
3 years ago
Process redesign and reengineering in 1500 words
timama [110]

Answer:

Process re-design is the process in which re-work is done to achieve the improvement in the output. The major aim is to set the goals for achieving the main objective.

The various essential steps in the process of re-design are:

  • Data capturing process are used to identify the process and making the necessary changes.
  • Identify every step of the process to ensure that process is in organized way along with the workflow.

Re-engineering is the process of re-design the system with focuses to improve the efficiency and quality. It basically analysis the whole business re-engineering process. The main step is to identify the need for the changes.

 

7 0
2 years ago
Other questions:
  • Which principle of design is she following
    9·1 answer
  • If you delete an imessage does the other person see it
    12·1 answer
  • A typical self-expelling fire extinguisher empties its contents in
    8·1 answer
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • If you were to create a new app for a smartphone or tablet that does not already exist, what would you create?
    10·1 answer
  • Could someone give an example or tell me what all of these mean? (For internet source citing) Evaluation: • Domain Name: • Autho
    7·1 answer
  • Plz hurry it’s timed
    5·1 answer
  • I will mark you as brainlist
    10·2 answers
  • In Python, the data structure that stores elements of the same data type is called an array.
    6·1 answer
  • Maria is conducting a security investigation and has identified a suspect. The suspect is an employee of the organization who ha
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!