Advertisement
35657

Untitled

Jan 26th, 2024
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8.     setlocale(LC_ALL, "ru");
  9.  
  10.     int count;
  11.     char ch;
  12.     int type;
  13.  
  14.     int i = 0;
  15.  
  16.     cout << "Введите количество символов: ";
  17.     cin >> count;
  18.     cout << "Введите символ: ";
  19.     cin >> ch;
  20.    
  21.     do {
  22.         cout << "Введите 1 для вывода горизонтальной линии или 2 для вывода вертикальной: ";
  23.         cin >> type;
  24.     } while (type != 1 && type != 2);
  25.  
  26.     if (type == 1) {
  27.         while (i < count) {
  28.             cout << ch;
  29.             i++;
  30.         }
  31.     }
  32.     else {
  33.         while (i < count) {
  34.             cout << ch << endl;
  35.             i++;
  36.         }
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement