Write a program in C++ to input a single character and print a message― it is vowel" if it is vowel otherwise print message "It is a "consonant― Use if-else structure and OR (||) operator only.
1
Expert's answer
2016-06-02T10:09:03-0400
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace Question {
class Letter_Class { private char letter;
public char Letter { get { return letter; } set { letter = value; } }
public bool IsVowel() { char letterUp = Char.ToUpper(letter); if (letterUp == 'A' || letterUp == 'O' || letterUp == 'U' || letterUp == 'I' || letterUp == 'E') return true; else return false; } } class Program { static void Main(string[] args) { Console.Write("Input letter: "); char letter = Console.ReadKey().KeyChar; Console.WriteLine(); Letter_Class LetterObj = new Letter_Class(); LetterObj.Letter = letter;
if (LetterObj.IsVowel()) Console.WriteLine("It is a vowel!"); else Console.WriteLine("It is a consonaut!");
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment