35657

Untitled

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