Let us see a list of important Switch case programming exercises and solutions in C++.
- Simple Calculator: Add, Subtract, Multiply, Divide
- hours and minutes as input and show that whether it is AM or PM
- 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 - convert a positive number into negative number and negative number into a positive number
- swap the values of two numbers if the values of both variables are not the same
- Convert even number into its upper nearest odd number
- 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.
- check Vowel
- take the value from the user as an input week number and print weekday
- take the value from the user as input the month number and print number of days in that month
- count the total number of notes in a given amount.
- take the value from the user as input all sides of a triangle and check whether the triangle is valid or not
- maximum between two numbers
- calculate profit or loss.
- Day of the Week: Print Day Name
- Vowel or Consonant Check
- Even or Odd Check
- Grade Calculation Based on Marks
- Month Name from Number
- Season from Month Number
- character is an alphabet or not
- character is an uppercase or lowercase alphabet
- Area Calculation: Circle, Square, Rectangle
- Convert Number to Words (1-9)
- Traffic Light Simulation: Red, Yellow, Green
- Number of Days in a Month
- Unit Conversion: Length (Meters to Kilometers, Centimeters, etc.)
- Week Number to Day of the Week
- Grade Point to Letter Grade Conversion
- Electricity Bill Calculation Based on Units Consumed
- Simple Interest Calculation
- Check Whether a Character is Uppercase or Lowercase
- Identify Type of Angle: Acute, Right, Obtuse
- Print a Simple Menu
If else with Switch
- if else with switch – Triangle Type Check: Equilateral, Isosceles, Scalene
- if else with switch – Leap Year Check