Advertisement
fqrmix

Untitled

Dec 2nd, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int switched_a(int a)
  6. {
  7.     switch (a)
  8.     {
  9.     case 0:
  10.         if (a < 0)
  11.         {
  12.             return 1;
  13.         }
  14.         else{
  15.             return 2;
  16.         }
  17.         break;
  18.  
  19.     case 1:
  20.  
  21.         if (a % 2 == 0)
  22.         {
  23.             return 3;
  24.         }
  25.         else {
  26.             return 4;
  27.         }
  28.         break;
  29.     case 2:
  30.  
  31.         break;
  32.     }
  33. }
  34. void output(int a)
  35. {
  36.     switch (a)
  37.     {
  38.     case 1:
  39.         printf("Число отрицательное");
  40.         break;
  41.     case 2:
  42.         printf("Число положительное");
  43.         break;
  44.     case 3:
  45.         printf("Число четное");
  46.         break;
  47.     case 4:
  48.         printf("Число нечетное");
  49.     }
  50. }
  51. int main()
  52. {
  53.  
  54.     int a = 54, k = 0, n = 0;
  55.     output(switched_a(n));
  56.  
  57.     return 0;
  58.     system("pause");
  59.    
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement