Created
October 15, 2024 12:57
-
-
Save juanfal/78182ce438d83f627d64bf4367a0c526 to your computer and use it in GitHub Desktop.
glass of wine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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