Advertisement
dllbridge

Untitled

Jan 11th, 2023
886
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.06 KB | None | 0 0
  1.  
  2.  
  3. #include     <cstdio>
  4. #include   <string.h>
  5.  
  6. char a[22] = "SONY";
  7.  
  8.  
  9. ///////////////////////////////////////////////////////////////
  10. int main()                                                   //
  11. {
  12.    
  13.    
  14.     strcpy(a, "Dima - Dima");
  15.    
  16.     int sizeStr = strlen(a);
  17.    
  18.     printf("sizeStr = %d\n ", sizeStr);
  19.  
  20.     for(int i = 0; i < 20; i++)
  21.     {
  22.      
  23.         printf("%c, ", a[i] );
  24.     }  
  25.     printf("\n");
  26.     for (int i = 0; i < 20; i++)
  27.     {
  28.        
  29.        
  30.         printf("%x - %d\n", &a[i], &a[i]);
  31.     }  
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. /*
  42.  
  43. #include <iostream>
  44. #include  <cstdlib>
  45. #include   <cstdio>
  46. #include    <ctime>
  47. using namespace std;
  48.  
  49. int a[22];
  50.  
  51.  
  52. ///////////////////////////////////////////////////////////////
  53. int main()                                                   //
  54. {
  55.    
  56.     srand(time(0));
  57.     for (int i = 0; i < 20; i++)
  58.     {
  59.         a[i] = rand()%100;
  60.         cout << a[i] << " ";
  61.     }  
  62.     cout << endl;
  63.     for (int i = 0; i < 20; i++)
  64.     {
  65.        
  66.        
  67.         printf("%x - %d\n", &a[i], &a[i]);
  68.     }  
  69. }
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. */
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. /*
  89.  
  90. #include <iostream>
  91. #include  <cstdlib>
  92. #include    <ctime>
  93. using namespace std;
  94.  
  95. void randomarray(int* a);
  96.  
  97.  
  98. ///////////////////////////////////////////////////////////////
  99. int main()                                                   //
  100. {
  101.    
  102.     int temp;
  103.     int arr [20];
  104.  
  105.     randomarray(arr);
  106.  
  107.     for(int i = 0; i < 20/2; i++)
  108.     {
  109.         temp = arr[i];
  110.         arr[i] = arr[20 - 1 - i];
  111.         arr[20 - 1 - i] = temp;
  112.     }
  113.  
  114.     for(int i = 0; i < 20; i++)
  115.     {
  116.         cout << arr[i] << " ";
  117.     }
  118.    
  119. }
  120.  
  121.  
  122. //  Заполнение массива случайными числами.
  123. //  И печать его содержимого в консоли.
  124. ///////////////////////////////////////////////////////////////
  125. void randomarray(int* a)                                     //
  126. {
  127.    
  128.     srand(time(0));
  129.     for (int i = 0; i < 20; i++)
  130.     {
  131.         a[i] = rand()%100;
  132.         cout << a[i] << " ";        
  133.     }
  134.     cout << endl;
  135. }
  136.  
  137.  
  138.  
  139.  
  140. */
  141.  
  142.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement