Skip to content

Instantly share code, notes, and snippets.

@juanfal
Created October 15, 2024 12:57
Show Gist options
  • Save juanfal/78182ce438d83f627d64bf4367a0c526 to your computer and use it in GitHub Desktop.
Save juanfal/78182ce438d83f627d64bf4367a0c526 to your computer and use it in GitHub Desktop.
glass of wine
// 12.wineGlass.cpp
// juanfc 2024-10-15
//
//
// Enter the half of the width (0 ends): 5
//
// ***********
// *********
// *******
// *****
// ***
// *
// *
// *
// *
// *
// *******
// *************
// New half of width (0 ends): 0
#include <iostream>
using namespace std;
int main()
{
cout << "Enter the height of the bowl: " << endl;
int w = 3;
// bowl
for (int line = 0; line < w; ++line) {
for (int i = 0; i <= line; ++i) cout << ' ';
for (int i = 0; i < 2 * (w-line) + 1; ++i) cout << '*';
cout << endl;
}
// stem
for (int line = 0; line < w; ++line) {
for (int i = 0; i <= w; ++i) cout << ' ';
cout << '*' << endl;
}
// foot
for (int line = 1; 3 * line <= w + 1 ; ++line) {
for (int i = 0; i <= w - 3 * line; ++i) cout << ' ';
for (int i = 0; i < 6 * line + 1; ++i) cout << '*';
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment