Advertisement
dllbridge

Untitled

Jul 6th, 2024
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.62 KB | None | 0 0
  1.  
  2. #include<stdio.h>
  3.  
  4.  
  5. int summa(int a, int b);
  6.  
  7. ///////////////////////////////////////////////
  8. int main()
  9. {
  10.    int a, b, c;
  11.  
  12.    scanf("%d%d%d", &a, &b, &c);
  13.    
  14.    switch(c)
  15.    {
  16.        
  17.         case 1: c = summa(a, b);
  18.                 printf("%d + %d = %d\n", a, b, a+b, c);
  19.                 break;
  20.        
  21.         case 2: c=a-b;
  22.                 printf("%d - %d = %d\n", a, b, c);
  23.                 break;
  24.        
  25.         case 3: c=a*b;
  26.                 printf("%d * %d = %d\n", a, b, c);
  27.                 break;  
  28.    }
  29.  
  30. }
  31.  
  32. /////////////////////////////////////////////
  33. int summa(int a, int b)
  34. {
  35.    
  36. return a + b;  
  37. }
  38.  
  39.  
  40.   // printf("%d\n",a);
  41.  //  printf("%d\n",b);
  42.  
  43.  
  44. /*   #include<stdio.h>
  45.  
  46. /////////////////////////////////
  47. struct   Big
  48. {
  49.     int length;
  50.     int  width;
  51. };
  52.  
  53.  
  54. ////////////////////////////////////////////
  55. int main()
  56. {
  57.     Big a, b;
  58.  
  59.     a.length = 12;
  60.    
  61.     printf("        a.length = %d\n", a.length);
  62.     printf("address a.length = %d\n", &a.length);
  63.     printf("address a. width = %d\n", &a.width);
  64. }*/
  65.  
  66.  
  67.  
  68.  
  69.  
  70. /*
  71.  
  72.  
  73. #include<stdio.h>
  74.  
  75. /////////////////////////////////
  76. struct   Big
  77. {
  78.     int   length;
  79.     int    width;
  80.     double   max;
  81.     float    min;
  82. };
  83.  
  84. void foo(Big *p );
  85. void f_2(Big *pb);
  86.  
  87. ////////////////////////////////////////////////
  88.  int main()
  89. {
  90.      Big b;
  91.  
  92.      printf(" adress lenght = %d\n", &b.length);
  93.      printf(" adress width  = %d\n", &b. width);
  94.      printf(" adress max    = %d\n", &b.   max);
  95.      printf(" adress min    = %d\n", &b.   min);
  96.      
  97.      foo(&b);
  98.      f_2(&b);    
  99. }
  100.  
  101.  
  102.  
  103. ////////////////////////////////////////////////
  104. void f_2(Big *pb)
  105. {
  106.    
  107.      printf(" adress lenght = %d\n", &pb->length);
  108.      printf(" adress width  = %d\n", &pb-> width);
  109.      printf(" adress max    = %d\n", &pb->   max);
  110.      printf(" adress min    = %d\n", &pb->   min); 
  111. }
  112.    
  113.  
  114.  
  115. ////////////////////////////////////////////////
  116. void foo(Big *pb)
  117. {
  118.    
  119.      char *p = (char*)pb;
  120.      
  121.      printf(" p     = %d\n", p);         p  = p + 4;
  122.      printf(" p + 4 = %d\n", p);         p  = p + 4;
  123.      printf(" p + 4 = %d\n", p);         p +=     8;
  124.      printf(" p + 8 = %d\n", p);    
  125. }
  126.  
  127. */
  128.  
  129.  
  130.  
  131.  
  132.  
  133. /*
  134.  
  135.  
  136. #include<stdio.h>
  137.  
  138. /////////////////////////////////
  139. struct   Big
  140. {
  141.     int   length;
  142.     int    width;
  143.     double   max;
  144.     float    min;
  145. };
  146.  
  147. ////////////////////////////////////////////////
  148.  int main()
  149. {
  150.      Big b;
  151.  
  152.      printf(" adress lenght = %d\n", &b.length);
  153.      printf(" adress width  = %d\n", &b. width);
  154.      printf(" adress max    = %d\n", &b.   max);
  155.      printf(" adress min    = %d\n", &b.   min);
  156. }
  157.  
  158.  
  159. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement