Advertisement
Guest User

romb

a guest
Oct 18th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using std::cout;
  4. using std::endl;
  5.  
  6. void dotPaint(int NUM, char DOT)
  7. {
  8. for (int i=0; i<NUM; i++)
  9. cout << DOT;
  10. }
  11.  
  12. int main() {
  13.  
  14. const int NUM=9;
  15.  
  16. int i;
  17.  
  18. for (i = 0; i < NUM/2; i++)
  19. {
  20. dotPaint(NUM/2-i, ' '); //4,3,2,1,0
  21. dotPaint(i*2+1, '*'); //1,3,5,7,9
  22.  
  23. cout << endl;
  24. }
  25.  
  26. for (i = NUM/2 ; i>=0; i--)
  27. {
  28. dotPaint(NUM/2-i, ' '); //0,1,2,3,4
  29. dotPaint(i*2+1, '*'); //9,7,5,3,1
  30.  
  31. cout << endl;
  32. }
  33.  
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement