Advertisement
MochaGovno

switch/case

May 23rd, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. switch and case
  2. #include <math.h>
  3. #include <stdio.h>
  4. main()
  5. {
  6.     int m; float a=3,i=2,y=2.7,x=1;
  7.     double v=0;
  8.     printf("Vvedite M: ");
  9.     scanf("%d",&m);
  10.     switch (m)
  11.     {
  12.     case 1: {
  13.             v=0.5*a+cos(a)/y;
  14.             printf("%6.2lf",v);
  15.     }break;
  16.     case 5:{
  17.             v=y*y-i;
  18.             printf("%6.2lf",v);
  19.     }break;
  20.     case 7: {
  21.             v=x+(x*x)/-1/3;
  22.             printf("%6.2lf",v);
  23.     } break;
  24.     default: printf("!!!!!!!!!!!!!!!!!NET RESHENIYA!!!!!!!!!!!!!!!!");
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement