Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- void line(int n, char sum, bool newLine = true)
- {
- int i = 0;
- while (i < n) {
- cout << "*";
- i++;
- }
- cout << endl;
- }
- void rect(int a, int b)
- {
- int i = 0;
- while (i < b) {
- cout << "*";
- line(b, false);
- i++;
- }
- cout << endl;
- }
- void triangle(int a) {
- int i = 0;
- while (i < a) {
- line(i, false);
- i++;
- }
- cout << endl;
- }
- void piramid(int a) {
- int i = 0;
- while (i < a) {
- line(i + 1, '*', true);
- line(i - i - 1, ' ', false);
- ++i;
- }
- }
- int main()
- {
- rect(8, 8);
- triangle(8);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement