djelad1

Untitled

Dec 6th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. void rhombus(int number, char symbol)
  2. {
  3. int i = 0, j = 0, k = 0;
  4. int temp = number;
  5. for (i = 0; i < number; i++)
  6. {
  7. for (j = 0; j < temp; j++)
  8. cout << symbol;
  9. for (j = 0; j < i; j++)
  10. cout << " ";
  11. for (j = 0; j < temp; j++)
  12. cout << symbol;
  13. cout << endl;
  14. temp--;
  15. }
  16. j = 2;
  17. temp = number - 2;
  18. for (i = 0; i<number-1; i++)
  19. {
  20. for (k = 0; k<j; k++)
  21. cout << symbol;
  22. for (k = 0; k<temp; k++)
  23. cout << " ";
  24. for (k = 0; k<j; k++)
  25. cout << symbol;
  26. temp--;
  27. j++;
  28. cout << endl;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment