Troubles with switch case in one program

Hello, i have to make a program which calculates triangle volume and surface
but the problem is that i have to use switch case to do it:
program should look like this:
enter value a:
enter value b:
enter value c:
and here i have to put number 1 if i want to calculate volume and 2 if i want to calculate surface
print should look like this:
volume of triangle is O=...
or
surface of triangle is P=...

please help with this so i can learn how to use switch case.
It has to be made in c++

Thanks in advance
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
switch(var)     // var is char,short,int or long
{
  case 12:       // var is 12
  {
    // do whatever
  } break;       // very important else will jump to next case
  case 17:       // var is 17
  {
    // do whatever
  } break;       // very important else will jump to next case
  default:        // catch-all for cases not dealt with above (may not need this)
  {
    // do whatever
  }                  // last case break not needed
}
Topic archived. No new replies allowed.