Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- using namespace std;
- enum Color { Black = 0, Blue, Green, Cyan, Red, Magenta, Brown, LightGray, DarkGray, LightBlue = 9, LightGreen, LightCyan, LightRed, LightMagenta, Yellow, White };
- HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
- void SetColor(Color text, Color background)
- {
- SetConsoleTextAttribute(hStdOut, (WORD)((background << 4) | text));
- }
- void main()
- {
- setlocale(0, "Russian");
- char loop;
- do
- {
- system("cls");
- int menu;
- cout << "Введите номер треугольника (1-4)" << endl;
- cin >> menu;
- int base;
- cout << "Введите ширину основания треугольника" << endl;
- cin >> base;
- if (base % 2 == 0)
- {
- base++;
- }
- if (menu == 1)
- {
- for (size_t i = 0; i < base/2+1; i++)
- {
- for (size_t j = 0; j < base; j++)
- {
- if (j == base / 2 || (j >= base / 2 - i && j <= base / 2 + i))
- {
- cout << "*";
- }
- else
- {
- cout << " ";
- }
- }
- cout << endl;
- }
- }
- else if (menu == 2)
- {
- }
- else if (menu == 3)
- {
- }
- else if (menu == 4)
- {
- }
- else
- {
- cout << "У меня для вас плохие новости, вы аутист..." << endl;
- }
- cout << "Продолжить ? (y - Да, n - Нет)" << endl;
- cin >> loop;
- }
- while (loop=='y'||loop=='Y');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement