Petro_zzz

lesson14_322

Sep 8th, 2023
1,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. #include  <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void task0() {
  6.     int a = 55;
  7.     int b = 43;
  8.     int c, d;
  9.     c = a++;
  10.     d = ++b;
  11.     cout << c << " " << d << endl;
  12. }
  13.  
  14. void task1() {
  15.     for (int k = 0; k < 5; k++) {
  16.         for (int n = 0; n <= k; n++) {
  17.             //if(n <= k)
  18.                 cout << "*";       
  19.         }
  20.         cout << endl;
  21.     }
  22. }
  23.  
  24. int n = 0;
  25.  
  26. void task2() {
  27.     int k = 0;
  28.     int n = 0;
  29.     while (k < 5) {
  30.         n = 0;
  31.         while(n <= k) {
  32.             //if(n <= k)
  33.             cout << "*";
  34.             n++;
  35.         }
  36.         cout << endl;
  37.         k++;
  38.     }
  39. }
  40.  
  41. void task3() {
  42.     int n = 0;
  43.     do {   
  44.         n++;
  45.         if (!(n % 3)) continue;    
  46.         if (!(n % 4)) continue;    
  47.         if (!(n % 5)) continue;
  48.         if (!(n % 23)) continue;       
  49.         cout << n << " ";      
  50.     } while (n <= 500);
  51.     cout << endl;
  52. }
  53.  
  54. void task4() {
  55.     for (int k = 0; k < 7; k++) {
  56.         for (int n = 0; n < 7; n++) {
  57.             if ((k == n) || ((k+n) == 6)
  58.                 || (k == 3) || (n == 3))
  59.                 cout << "* ";
  60.             else
  61.                 cout << "  ";
  62.         }
  63.         cout << endl;
  64.     }
  65. }
  66.  
  67. void task5() {
  68.     for (int y = 3; y >= -3; y--) {
  69.         for (int x = -3; x <= 3; x++) {
  70.             if ((x == y) || (x == -y)
  71.                 || (y == 0) || (x == 0))
  72.                 cout << "* ";
  73.             else
  74.                 cout << "  ";
  75.         }
  76.         cout << endl;
  77.     }
  78. }
  79.  
  80. void test_array() {
  81.     const int size = 8;
  82.     int x[size]{0, 1,2,3,4,5,6,7}; 
  83.     /*
  84.     const char* str1 = "dasdasdasd";
  85.     char str[100]{ 's', 'd' };
  86.     string str;
  87.     */
  88.     /*
  89.     x[0] = 1;
  90.     x[1] = 2;
  91.     x[2] = 4;
  92.     x[3] = 7;
  93.     */
  94.     for (int n = 0; n < size; n++)
  95.         cin >> x[n] ;
  96.     for(int n = 0; n < size; n++)
  97.         cout << x[n] << " ";   
  98.     cout << endl;
  99. }
  100.  
  101.  
  102. int main() {
  103.     test_array();
  104. }
Advertisement
Add Comment
Please, Sign In to add comment