Advertisement
dllbridge

Untitled

Nov 4th, 2023
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.53 KB | None | 0 0
  1.  
  2. #include  <stdio.h>
  3. #include <stdlib.h>
  4. #include   <time.h>
  5.  
  6. void foo(int &);
  7.  
  8. ////////////////////////////////////////////////////////////////////////
  9. int main()                                                            //
  10. {
  11.    
  12.     int massiv[20] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19 };
  13.    
  14. //  srand(time(0));
  15.    
  16.     for (int i = 0; i < 20; i++) massiv[i] = rand()%100;
  17.    
  18. //  int& ssilka = massiv[11];
  19.    
  20.     foo(massiv[11]);
  21.    
  22.     printf("\n\n\n");
  23.    
  24.     for (int i = 0; i < 20; i++)
  25.     {
  26.         printf("%d, ", massiv[i]);
  27.     }
  28. }
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. /////////////////////////////////////////////////////////////////////////
  42. void foo(int& count)
  43. {
  44.     int* adress = &count;
  45.     for (int i = 0; i < 20; i++)
  46.     {
  47.         printf("%d, ", adress[i - 11]);
  48.     }
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. /*
  80. #include <stdio.h>
  81.  
  82. int count1, count2, count3;
  83.  
  84. char znak(int count1, int count2, int count3);
  85.  
  86.  
  87.  
  88.  
  89. //////////////////////////////////////////////////////////////////
  90. int main()                                                      //  
  91. {
  92.    
  93.     int count = 0;
  94.  
  95.     scanf("%d", &count);
  96.     for (int i = 0; i < count; i++)
  97.     {
  98.  
  99.         scanf("%d%d%d", &count1, &count2, &count3);
  100.         printf("%c\n", znak(count1, count2, count3));
  101.     }
  102. }
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. ////////////////////////////////////////////////////////////////
  110. char znak(int count1, int count2, int count3)                 //
  111. {
  112.    
  113.          if(count1 + count2 == count3) return('+');
  114.     else if(count1 - count2 == count3) return('-');
  115. }
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. */
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement