Intro to C++
 Session 5- Two Sample C++ Programs
By Coding-Bootcamps.com

###########################################
###########################################
###########################################
Switch-Case
###########################################
Program # 1: Vowel Character

//Program to find out the given character is vowel or not
#include <iostream>
using namespace std;

int main() {
	char characterEntered;
	bool isVowel;
	cout << "Please enter a character: " << endl;
	cin >> characterEntered;
	// Switch-case statement
	switch (characterEntered) {
	case 'a':
		isVowel = true; break;
	case 'i':
		isVowel = true; break;
	case 'e':
		isVowel = true; break;
	case 'o': 
		isVowel = true; break;
	case 'u':
		isVowel = true; break;
	default:
		isVowel = false;
	}
	if (isVowel) cout << "The character is a vowel. " << endl;
	else cout << "The character is not a vowel. " << endl;

	return 0;
}


########################################


Program # 2: Arithmetic Operations
//Program to solve arithmetic operations
#include <iostream>
using namespace std;

int main() {
	int x, y, result;
	char operatorEntered;
	bool validOperatorChosen = true;
	cout << "Please enter the first number: " << endl;
	cin >> x;
	cout << "Please enter the second number: " << endl;
	cin >> y;
	cout << "Please enter an arithmetic operator (i.e. \"+\" is for adding): " << endl;
	cin >> operatorEntered;

	switch (operatorEntered) {
		case '+':
			result = x + y; break;
		case '-':
			result = x - y; break;
		case '*':
			result = x * y; break;
		case '/':
			result = x / y; break;
		default: 
			cout << "Invalid operator entered." << endl;
			validOperatorChosen = false;
	}
	if(validOperatorChosen)	cout << "Result is: " << result << endl;
	return 0;
}


###########################################


