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 a domestic business activity?
harkovskaia [24]
What are the options?

7 0
3 years ago
Read 2 more answers
List 100 social media with functions​
olga55 [171]

Answer:

J

Explanation:

6 0
3 years ago
You want to connect the LAN port on a router to the uplink port on a switch. The switch does not support auto-MDI. Which type of
kirza4 [7]

Answer: Crossover

Explanation:

Based on the information given in the question, the type of cable that should be used is the crossover cable.

Crossover cable is used for a direct connection of computing devices. A crossover cable is typically used for the connection of computing devices that are of identical types.

Since the LAN port on a router is to be connected to the uplink port on a switch and the switch does not support auto-MDI, the crossover cable can be used.

3 0
2 years ago
You can run a macro by:
oee [108]

Selecting the button assigned

Using the shortcut Keys assigned

Explanation:

By clicking the assigned button one can run a macro and we can assign a short cut key to macro which we created.

So, the two options we can use to run a macro.

7 0
3 years ago
Describe and list advantages and disadvantages of each of the following backup types:
crimeas [40]

Answer:

Full back up

It creates complete copy of the source of data. This feature made it to the best  back  up with good speed of recovery of the data and  simplicity.However, because it  is needed for backing up  of  a lot of data, it is time consuming process,Besides it also  disturbs the routine application of  the technologist infrastructure. In addition large capacity storage is needed  for the  storage of  the large volume of back up with each new creation.

Incremental back up: back up work at high speed thus saves time, Little storage capacity is needed. This type of back up can be run as  many time as wished.

However, the restoration of data takes time, due to the time spent for restoration of initial back up and the incremental.

Differential Back up has very fast back up operation, because it only requires two pieces of back up.This is however slower compare to the Incremental.

The selective back up enable selection of certain type of file or folders for back up.

it can only be used to back up folders only when important data  are needed only.Thus the  storage capacity is low.

CPD eliminates back up window and reduces the recovery point objective.However, it has issue of compatibility with the resources to back up.,it is also expensive because its solutions are disk based.

Cloud based is affordable and save cost,It is easier to access. it is efficient,it can be access remotely for convenience.

However, Internet sources and some bandwidth must be available for access., always depends on third party providers,There is also problems encountered when switching providers.

Explanation:

8 0
3 years ago
Other questions:
  • While moving into a new apartment, Titus needed to hold the door open with something heavy. It suddenly dawned on him that he co
    9·1 answer
  • The overall purpose of a food guide is________.
    11·1 answer
  • True false you cannot fill in a callout​
    14·1 answer
  • Which information is necessary to determine an object's speed?
    13·1 answer
  • ICT excel data homework
    10·1 answer
  • select all examples of proper keyboarding technique. rest your fingers gently on the home row or home keys. slouch in your chair
    9·2 answers
  • Users of an access point share the transmission capacity of the access point. The throughput a user gets is called the ________.
    11·1 answer
  • The first step to accurate coding is to identify the ___________ in the diagnostic statement.
    7·1 answer
  • Write an assembly code to implement the y=(x1+x2)*(x3+x4) expression on 2-address machine, and then display the value of y on th
    7·1 answer
  • Plzz help me with this question.........
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!