Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. // ConsoleApplication3.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     char zn1 = '*';
  11.     char zn2 = '<';
  12.     char zn3 = '>';
  13.     int n;
  14.     cout << "n = ";
  15.     cin >> n;
  16.     if (n <= 0 || n%2==0) {
  17.         cout << "niepoprawne dane" << endl;
  18.         system("pause");
  19.         return 0;
  20.     }
  21.     for (int i = 0;i < n;i++) {
  22.         if (i != (n / 2) ){
  23.             for (int j = 0;j < n-1;j++)
  24.                 cout << " ";
  25.             cout << zn1;
  26.         }
  27.         else {
  28.             for (int j = 0;j < (n / 2);j++)
  29.                 cout << zn2 << " ";
  30.             cout << zn1<<" ";
  31.             for (int j = 0;j < (n / 2);j++)
  32.                 cout << zn3 << " ";
  33.         }
  34.         cout << endl;
  35.     }
  36.     system("pause");
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement