Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cout;
- using std::endl;
- void dotPaint(int NUM, char DOT)
- {
- for (int i=0; i<NUM; i++)
- cout << DOT;
- }
- int main() {
- const int NUM=9;
- int i;
- for (i = 0; i < NUM/2; i++)
- {
- dotPaint(NUM/2-i, ' '); //4,3,2,1,0
- dotPaint(i*2+1, '*'); //1,3,5,7,9
- cout << endl;
- }
- for (i = NUM/2 ; i>=0; i--)
- {
- dotPaint(NUM/2-i, ' '); //0,1,2,3,4
- dotPaint(i*2+1, '*'); //9,7,5,3,1
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement