Advertisement
Guest User

trojkat.cpp

a guest
Jan 23rd, 2020
69
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. using namespace std;
  3.  
  4. void trojkat(int wys, int szer)
  5. {
  6.     for(int i=0; i<wys; i++)
  7.     {
  8.         cout << "|";
  9.         if(i<wys-1)
  10.         for(int j=0; j<i; j++)
  11.         {
  12.         cout << " ";
  13.         }
  14.         if(i<wys-1)
  15.         cout << "\\";
  16.         if(i<wys-1)
  17.         cout << endl;
  18.     }
  19.     for(int k=0; k<szer; k++)
  20.     {
  21.         cout << "_";
  22.     }
  23.     cout << "\\";
  24.  
  25.  
  26. }
  27.  
  28. int main()
  29. {
  30.     int szer, wys;
  31.     cout << "wysokosc: ";
  32.     cin >> wys;
  33.     //cout << "szerokosc: ";
  34.     //cin >> szer;
  35.     szer = wys-1;  // Inaczej trojkat sie rozjezdza i jest hoj :(
  36.     trojkat(wys, szer);
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement