Question

In: Electrical Engineering

Use a switch statement to write a function that returns TRUE if a character is a...

Use a switch statement to write a function that returns TRUE if a character is a consonant and returns FALSE otherwise.

Solutions

Expert Solution

I have tested this program in my code block, it is working fine.


#include<stdio.h>
char choice;
void main( )
{
while(1){
        /* Printing the available options */
        printf("Enter an alphabet\n");


        /* Taking users input */
        scanf("%c", &choice);

        switch(choice)
        {
            case 'a':
                printf("FALSE");
                break;
            

            case 'e':
                printf("FALSE");
                break;
            

            case 'i':
                printf("FALSE");
                break;
            

            case 'o':
                printf("FALSE");
                break;
           

            case 'u':
                printf("FALSE");
                break;
         

            default:
                printf("TRUE\n");
    }
scanf("%c", &choice);
}

}


Related Solutions

Write a function that takes a number as input, and returns the character A if the...
Write a function that takes a number as input, and returns the character A if the input is 90 and above, B if it’s 80 and above but less than 90, C if it’s at least 70 but less than 80, D if it’s at least 60 but less than 70, and F if it’s less than 60. If the input is not a number or is negative, the function should exit 1 with an error (by calling the Matlab...
Use a switch statement on a char variable to write a function that's a simple calculator...
Use a switch statement on a char variable to write a function that's a simple calculator that keeps running waiting for input Should have a do while loop that continually loops the function, prompting for a new input and new operator, until the calculator returns 0, in which case it will close.
Using c# , Write a program using a switch statement that takes one character value from...
Using c# , Write a program using a switch statement that takes one character value from the user and checks whether the entered value is an arithmetic operator (+, -, * , /) If not the program display a message that it not of the operators ( (+, -, * , /) .
JAVA PLEASE!! Write a value-returning method, isVowel, that returns the value true if a given character...
JAVA PLEASE!! Write a value-returning method, isVowel, that returns the value true if a given character is a vowel, and otherwise returns false. Also write a program to test your method. 2) Write a program that prompts the user to input a sequence of characters and outputs the number of vowels. (Use the method isVowel written in Programming Exercise 1.)
Write a boolean function that is given a binary tree and returns true if and only...
Write a boolean function that is given a binary tree and returns true if and only if the tree has an odd number of nodes. An empty tree is considered to have an even number of nodes. Notes: The function should have just one argument, a pointer to the root. No global variables may be used. No additional functions may be defined. You may not count the number of nodes.
Write function boolean isSorted(int a[], int size). The function returns true if array a is sorted...
Write function boolean isSorted(int a[], int size). The function returns true if array a is sorted in either ascend order or descend order; false otherwise. c++
PYTHON: Write a function named is_palindrome() that returns boolean True if a word or phrase is...
PYTHON: Write a function named is_palindrome() that returns boolean True if a word or phrase is a palindrome, and boolean False if it is not. The palindromes for this problem are contained in the list below. You must use this list in your solution. Use a for loop to retrieve each palindrome and test it. Your script should test each string in the list of palindromes below. Be aware there's a second list of palindromes embedded in the palindromes list....
Write an evenTest(n) function that returns True if it is given an even integer and False...
Write an evenTest(n) function that returns True if it is given an even integer and False if it is given an odd number. The rest of your code (outside of the function) should get an integer number from the user, call evenTest(n) to test if the number is even, and then tell the user if the number was even or odd. Name the program even_or_odd.py. Part 2. Salary.py (5 pts) You are offered two options to receive salary: • Option...
Write a function sublist that takes two lists as arguments, and returns true if the first...
Write a function sublist that takes two lists as arguments, and returns true if the first list appears as a contiguous sublist somewhere within the second list, and false otherwise. > (sublist ’(c d e) ’(a b c d e f g)) #t > (sublist ’(a c e) ’(a b c d e f g)) #f Write a function lgrep that returns the “lines” within a list that contain a given sublist. Use the sublist function implemented in previous exercise...
Write TRUE if the statement is TRUE. If the statement is FALSE, write FALSE and explain...
Write TRUE if the statement is TRUE. If the statement is FALSE, write FALSE and explain why 3. The Commissioner of Internal Revenue may prescribe presumptive gross sales and receipts for a taxpayer when the latter fails to issue receipts and when he believes that the books or other records of the latter do not correctly reflect declarations in the return. 4. Jurisdiction is the power and authority of the court to hear, try, and decide a case. It can...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT