Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void rysuj(int h, int index = 0, int newindex = 0)
- {
- if ((h / 2) - index >= 0)
- {
- for (int i = 0; i < ((h / 2) - index); i++)
- {
- cout << " ";
- }
- for (int i = 0; i < index; i++)
- {
- cout << "/";
- }
- cout << endl;
- index++;
- rysuj(h, index);
- }
- else if ((h / 2) - index < 0)
- {
- for (int i = 0; i < newindex; i++)
- {
- cout << " ";
- }
- for (int i = 0; i <(h / 2)-newindex; i++)
- {
- cout << "\\";
- }
- newindex++;
- cout << endl;
- if (newindex != h / 2)
- {
- rysuj(h, index, newindex);
- }
- }
- }
- int main()
- {
- int h;
- cout << "Wprowadz wysokosc strzalki: ";
- cin >> h;
- rysuj(h);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement