TheRasVa

Задача 2,11

Mar 21st, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. // Задача 2,11.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8.  
  9. int main()
  10. {
  11.     char a;
  12.     int N;
  13.     setlocale(LC_ALL, "russian");
  14.     cout << "Введите высоту: ";
  15.     cin >> N;
  16.     cout << "Введите знак: ";
  17.     cin >> a;
  18.     int k = N*2 - 1;
  19.     for (int i = N - 1; i >= 0; i--){
  20.         for (int j = 1; j <= k; j++){
  21.             if ((j <= i) || (j > (k - i))){
  22.                 cout << " ";
  23.             }
  24.             else cout << a;
  25.         }
  26.         cout << endl;
  27.     }
  28.     system("PAUSE");
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment