Guest User

Untitled

a guest
Feb 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. if (menu_choice == "D" || menu_choice == "d")
  2. {
  3. cout << "You have selected to print a diamond shape of characters.\n";
  4. cout << "Please enter the character you wish to use: ";
  5. cin >> character;
  6. cout << "Please enter the width of the diamond (odd number): ";
  7. cin >> width;
  8. if ((width%2)==0 || width < 0)
  9. {
  10. cout << "The width should be POSITIVE and ODD. Please re-enter the width: ";
  11. cin >> width;
  12. }
  13. for (int i = 1 ; i <= ((width+1)/2); i++)
  14. {
  15. for (int j = width ; j > i ; j--)
  16. {
  17. cout << " ";
  18. }
  19. for (int k = i ; k >= 1 ; k--)
  20. {
  21. cout << character;
  22. }
  23. for (int m = 2; m <= i; m++)
  24. {
  25. cout << character;
  26. }
  27. cout << endl;
  28. }
  29. }
Add Comment
Please, Sign In to add comment