Ask Your Question
1

What are the functions that take a char as input and use a switch statement?

asked 2022-08-26 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-22 15:00:00 +0000

lalupa gravatar image

Some common functions that take a char as input and use a switch statement are:

  1. toUpperCase(char c): This function takes a lowercase char as input and returns its uppercase equivalent using a switch statement.

  2. toLowerCase(char c): This function takes an uppercase char as input and returns its lowercase equivalent using a switch statement.

  3. isVowel(char c): This function takes a char as input and returns true if the char is a vowel (a, e, i, o, u) using a switch statement.

  4. calculate(char operator, double num1, double num2): This function takes a char as input to represent a mathematical operator (+, -, *, /) and two numbers (num1 and num2). It returns the result of performing the specified operation on the given numbers using a switch statement.

  5. monthName(char month): This function takes a char as input to represent a month (J for January, F for February, etc.) and returns the full name of the month using a switch statement.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-08-26 11:00:00 +0000

Seen: 7 times

Last updated: Aug 22 '22