Question

In: Computer Science

Write a subroutine that will receive a char input value. This subroutine should then use a...

Write a subroutine that will receive a char input value. This subroutine should then use a switch statement to determine if the char is a vowel, consonant, digit, or other type of character.

Write the subroutine only,

Solutions

Expert Solution

Here I have preffered C for creating subroutine, As no language preference was given

It will receive a char input value

after than it will use switch statement

void main()
{
char s;
scanf("%c",&s);
switch(s)
{
case '0':
printf("Digit");
break;
case '1':
printf("Digit");
break;
case '2':
printf("Digit");
break;
case '3':
printf("Digit");
break;
case '4':
printf("Digit");
break;
case '5':
printf("Digit");
break;
case '6':
printf("Digit");
break;
case '7':
printf("Digit");
break;
case '8':
printf("Digit");
break;
case '9':
printf("Digit");
break;
case 'a':
printf("Vowel");
break;
case 'e':
printf("Vowel");
break;
case 'i':
printf("Vowel");
break;
case 'o':
printf("Vowel");
break;
case 'u':
printf("Vowel");
break;
case 'A':
printf("Vowel");
break;
case 'E':
printf("Vowel");
break;
case 'I':
printf("Vowel");
break;
case 'O':
printf("Vowel");
break;
case 'U':
printf("Vowel");
break;
case 'b':
printf("Consonant");
break;
case 'c':
printf("Consonant");
break;
case 'd':
printf("Consonant");
break;
case 'f':
printf("Consonant");
break;
case 'g':
printf("Consonant");
break;
case 'h':
printf("Consonant");
break;
case 'j':
printf("Consonant");
break;
case 'k':
printf("Consonant");
break;
case 'l':
printf("Consonant");
break;
case 'm':
printf("Consonant");
break;
case 'n':
printf("Consonant");
break;
case 'p':
printf("Consonant");
break;
case 'q':
printf("Consonant");
break;
case 'r':
printf("Consonant");
break;
case 's':
printf("Consonant");
break;
case 't':
printf("Consonant");
break;
case 'v':
printf("Consonant");
break;
case 'w':
printf("Consonant");
break;
case 'x':
printf("Consonant");
break;
case 'y':
printf("Consonant");
break;
case 'z':
printf("Consonant");
break;
case 'B':
printf("Consonant");
break;
case 'C':
printf("Consonant");
break;
case 'D':
printf("Consonant");
break;
case 'F':
printf("Consonant");
break;
case 'G':
printf("Consonant");
break;
case 'H':
printf("Consonant");
break;
case 'J':
printf("Consonant");
break;
case 'K':
printf("Consonant");
break;
case 'L':
printf("Consonant");
break;
case 'M':
printf("Consonant");
break;
case 'N':
printf("Consonant");
break;
case 'P':
printf("Consonant");
break;
case 'Q':
printf("Consonant");
break;
case 'R':
printf("Consonant");
break;
case 'S':
printf("Consonant");
break;
case 'T':
printf("Consonant");
break;
case 'V':
printf("Consonant");
break;
case 'W':
printf("Consonant");
break;
case 'X':
printf("Consonant");
break;
case 'Y':
printf("Consonant");
break;
case 'Z':
printf("Consonant");
break;
default:
printf("Other type of character");
}
}

Hope it helps !! If any problem Do comment


Related Solutions

Write a subroutine that will receive a char input value. This subroutine should then use a...
Write a subroutine that will receive a char input value. This subroutine should then use a switch statement to determine if the char is a vowel, consonant, digit, or other type of character. Write the subroutine only, This is in C++
c++ Write the definition of a function named ‘isLower’ that takes as input a char value...
c++ Write the definition of a function named ‘isLower’ that takes as input a char value and returns true if the character is lowercase; otherwise, it returns false.•Print the message “The character xis lowercase” when returned value above is true, and vice versa.
Write a subroutine that takes an int (.long) parameter and squares it. The parameter should be...
Write a subroutine that takes an int (.long) parameter and squares it. The parameter should be passed in on the stack. The answer should be returned in eax. The subroutine should not disturb any registers except eax, ecx, and edx. (Save any registers on the stack and restore them before exiting the subroutine.) Upon entry to the subroutine, push ebp, etc., to access the parameter.
Write a Java method that takes an array of char and a String as input parameters...
Write a Java method that takes an array of char and a String as input parameters and and returns an boolean. The method returns true if we can find the input string inside the array by starting at any position of the array and reading either forwards or backwards.
write a java program to Translate or Encrypt the given string : (input char is all...
write a java program to Translate or Encrypt the given string : (input char is all in capital letters) { 15 } *) Each character replaced by new character based on its position value in english alphabet. As A is position is 1, and Z is position 26. *) New characters will be formed after skipping the N (position value MOD 10) char forward. A->A+1= B , B->B+2=D ,C->C+3=F, .... Y->Y+(25%10)->Y+5=D A B C D E F G H I...
Write a function that will receive two input arguments that is the height in inches (in.)...
Write a function that will receive two input arguments that is the height in inches (in.) and the weight in pounds (lb) of a person and return two output arguments that is the height in meters (m) and mass in kilograms (kg). Determine in SI units the height and mass of a 5 ft.15 in. person who weight 180 lb. Determine your own height and weight in SI units. Note: 1 meter = 39.3701 inch, 1 foot = 12 inches,...
Use python write a function that translates the input string into Pig Latin. The translation should...
Use python write a function that translates the input string into Pig Latin. The translation should be done word by word, where all words will be separated by only one space. You may assume that each word must have at least one vowel (a,e,i,o,u and uppercased counterparts), and there will be no punctuation or other special characters in the input string. The Pig Latin rules are as follows: For words that begin with consonants, all letters before the initial vowel...
Use MATLAB to write a function subroutine horner_yourlastname(a, x0, d) that uses Horner’s algorithm to evaluate...
Use MATLAB to write a function subroutine horner_yourlastname(a, x0, d) that uses Horner’s algorithm to evaluate a polynomial at a given point x0. This code should have three inputs in the order specified above: a: a vector of coefficients of the polynomial of interest. The first element of the vector should be the leading coefficient, and the last element should be the trailing coefficient. i. e. The polynomial p(x) = anx n + an−1x n−1 . . . a1x +...
Maximum value and its index in an array java program that: Receive as input in command...
Maximum value and its index in an array java program that: Receive as input in command line the size of an array (n) Generate an array with numbers between 1 and 100 (inclusive 1 and 100) with the given size (a) Print the array with the format: {a, b, c, ..., x}, for instance {1, 2} Compute and print in the console the following: maximum value in the array one index on which the maximum value appears (a number from...
Minimum value and its position Create a program that: Receive as input in command line the...
Minimum value and its position Create a program that: Receive as input in command line the sizes m and n of a two dimensional array, and minValue and maxValue between which the random numbers will be generated Generate a array with numbers between minValue and maxValue (inclusive) with the given size (mxn) Compute the minimum value in the array and one of the rows and columns on which it appears. Print the array as a table. Print the minimum value...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT