Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int number;
- cout << "Enter an odd number width: ";
- cin >> number;
- cout << number << endl << endl;
- cout << "Hill:" << endl;
- for (int a = 1; a <= number; a+=2)
- {
- for (int b = 1; b <= a; b++)
- {
- cout << "*";
- }
- cout << endl;
- }
- cout << "Triangle:" << endl;
- int tr = 1;
- for (int a = 1; a <= ((number / 2) + 1); a++)
- {
- for (int b = number; b >= a; b--)
- {
- cout << " ";
- }
- for (int c = 0; c < tr; c++)
- {
- cout << "*";
- }
- cout << endl;
- tr = tr + 2;
- }
- cout << "Diamond:" << endl;
- int dia = 1;
- for (int a = 1; a <= ((number / 2) + 1); a++)
- {
- for (int b = number; b >= a; b--)
- {
- cout << " ";
- }
- for (int c = 0; c < dia; c++)
- {
- cout << "*";
- }
- cout << endl;
- dia = dia + 2;
- }
- int dia2 = number;
- for (int a = 1; a <= ((number / 2) + 1); a++)
- {
- for (int b = number; b <= a; b--)
- {
- cout << " ";
- }
- for (int c = 0; c < dia2; c++)
- {
- cout << "*";
- }
- cout << endl;
- dia2 = dia2 - 2;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement