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
Arnie is planning an action shot and wants the camera to move smoothly alongside his running characters. He is working on a tigh
cricket20 [7]
Camera and wagon are answer
4 0
3 years ago
Help!!!!!!<br>please<br>Who will give the answer I'll mark him/her as brainlist..​
damaskus [11]
17, 12.5, 6, and 10. HOPE THIS HELPS
4 0
3 years ago
Which of the following BEST represent the Scrum approach to planning?
evablogger [386]

Answer:

this is the answer I think

7 0
3 years ago
In order to simplify console access to computers in a rack, what device is typically used to provide a central portal for all de
Lisa [10]

Answer:

The answer is A. KVM switch.

Explanation:

In order to simplify console access to computers in a rack, what device is typically used to provide a central portal for all devices on the rack?âA) KVM switch.âB) AVR switch.C) Terminal server.âD) Multi-monitor breakout cable

The answer is A. KVM switch.

A KVM switch (with KVM which is an abbreviation for "keyboard, video and mouse") is a hardware device that allows a user to control multiple computers from one or more sets of keyboards, video monitors, and mice.

4 0
3 years ago
A 16 x 2 audio console has (A) 16 inputs and 2 outputs (B) 16 slide faders and 2 monitor systems (C) 16 VU meter
IRINA_888 [86]

Answer:

(A) 16 inputs and 2 outputs.

Explanation:

An audio signal can be defined as a representation of sound, either as an analog or digital signals. An analog audio signal refers to a continuous signal that is represented by a changing level of quantity such as voltage with respect to time. sequence of bits such as 16kbps, 32kbps, 64kbps, 96kbps, 128kbps, 196kbps, and 320kbps. Kbps means kilobits per seconds.

A speaker can be defined as an electronic output device that is typically used for the conversion of an electromagnetic wave to sound wave.

Basically, this conversion is done through the help of a hardware electronic component known as transducers.

The main purpose of a speaker is to produce an audio output and as such avail the computer users an ability to hear or listen to sounds.

Similarly, an audio console is an electronic device that is designed for combining or mixing audio signals received from multiple audio sources and sends them out as one.

Thus, a 16 x 2 audio console has 16 inputs for receiving sixteen (16) audio signals and sends them out as 2 outputs.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Very large and very small numbers are easier to write in scientific notation. For example, the number, 0.000000728 would be writ
    7·1 answer
  • When building systems, the only two entities that constitute software engineering are people and process.
    9·1 answer
  • What is the protocol in the web search at the bottom?
    13·1 answer
  • Given that two int variables, total and amount, have been declared, write a sequence of statements that: initializes total to 0
    14·1 answer
  • List 7 basic internal component found in a computer tower?
    11·2 answers
  • The person in charge of recording the sound should always
    15·1 answer
  • Identify which of these types of sampling is​ used: random,​ systematic, convenience,​ stratified, or cluster. To determine her
    13·1 answer
  • For each of the following languages, state with justification whether it isrecognizableor unrecognizable.(a)LHALT≥376={(〈M〉, x)
    10·1 answer
  • how many usable host addresses are available for each subnet when 4 bits are borrowed from a class C IP address
    11·1 answer
  • What is the best way to pay for college?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!