# Switch case programming exercises and solutions in C++

Let us see a list of important Switch case programming exercises and solutions in C++.

## Basic Tutorial of conditional statements

1. Using switch statement Write a C program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F
2. C++  Program to find the maximum between two numbers. Using the switch statement. Download Program to find maximum
3.  C++  Program to find the maximum between three numbers. Using the switch statement.
4.  C++  Program to check whether a number is divisible by 5 and 11 or not. Using the switch statement.
5.  C++  Program to check whether a year is a leap year or not. Using switch statement
6.  C++  Program to check whether a character is an alphabet or not. Using the switch statement. Click Here
7.  C++  Program to take the value from the user as input any alphabet and check whether it is vowel or consonant. Using the switch statement. C++Program to check Vowel
8.  C++  Program to take the value from the user as input any character and check whether it is the alphabet, digit or special character. Using the switch statement.  C++  Program Details
9.  C++  Program to check whether a character is an uppercase or lowercase alphabet. Using the switch statement. Click Here
10.  C++  Program to take the value from the user as an input week number and print weekday by using the switch statement. Weekday Program
11.  C++  Program to take the value from the user as input the month number and print number of days in that month. Using switch statement – Click Here
12.  C++  Program to count the total number of notes in a given amount. Using the switch statement. Click Here
13.  C++  Program to take the value from the user as input all sides of a triangle and check whether the triangle is valid or not. Using switch statement – Click Here
14.  C++  Program to check whether the triangle is an equilateral, isosceles or scalene triangle. Using switch statement
15.  C++  Program to find all the roots of a quadratic equation. Using switch statement
16.  C++  Program to calculate profit or loss. Using switch statement. Program to calculate profit or loss
17. Using switch statement  C++  Program to take the value from the user as input marks of five subjects Physics, Chemistry, Biology, Mathematics, and Computer. Calculate percentage and grade according to the following: Percentage >= 90% : Grade A, Percentage >= 80% : Grade B, Percentage >= 70% : Grade C, Percentage >= 60% : Grade D, Percentage >= 40% : Grade E, Percentage < 40% : Grade F, Using switch statement.
18.  C++  Program to take the value from the user as input the basic salary of an employee and calculate its Gross salary according to the following: Basic Salary <= 10000: HRA = 20%, DA = 80%………………………………..Basic Salary <= 20000 : HRA = 25%, DA = 90%………………………………Basic Salary > 20000 : HRA = 30%, DA = 95%.
19. C++  Program to take the value from the user as input electricity unit charges and calculate total electricity bill according to the given condition: For the first 50 units Rs. 0.50/unit………….For the next 100 units Rs. 0.75/unit…..For the next 100 units Rs. 1.20/unit ……………For unit above 250 Rs. 1.50/unit………An additional surcharge of 20% is added to the bill…….Using the switch statement. C++Program to find the bill.
20. Write a program that determines a student’s grade. The program will read three types of scores (quiz, mid-term, and final scores) and determine the grade based on the following rules:if the average score =90% =>grade=A…………………..-if the average score >= 70% and <90% => grade=B……………………-if the average score>=50% and <70% =>grade=C……………………..-if the average score<50% =>grade=F
21. Program to take the hours and minutes as input by the user and the show that whether it is AM or PM by using the switch statement. Click Here
22. Program to convert a positive number into negative number and negative number into a positive number using switch  statement Click Here
23. Write a program to swap the values of two numbers if the values of both variables are not the same using a switch statement. C++ Code
24. Program to Convert even number into its upper nearest odd number Switch Statement. Even and odd conversion program  Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,