Advertisement
dllbridge

Untitled

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