Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "header.h"
- void TamGiacVuong1(int Cao)
- {
- for (int i = 1; i <= Cao; i++)
- {
- for (int j = 1; j <= i; j++)
- {
- cout << "*";
- }
- cout << endl;
- }
- }
- void TamGiacVuong2(int Cao)
- {
- for (int i = 1; i <= Cao; i++)
- {
- for (int k = 1; k <= Cao - i; k++)
- {
- cout << " ";
- }
- for (int j = 1; j <= i; j++)
- {
- cout << "*";
- }
- cout << endl;
- }
- }
- void TamGiacVuong3(int Cao)
- {
- for (int i = 1; i <= Cao; i++)
- {
- for (int j = 0; j <= Cao - i; j++)
- {
- cout << "*";
- }
- cout << endl;
- }
- }
- void TamGiacVuong4(int Cao)
- {
- for (int i = 1; i <= Cao; i++)
- {
- for (int k = 1; k <= i; k++)
- {
- cout << " ";
- }
- for (int j = 0; j <= Cao - i; j++)
- {
- cout << "*";
- }
- cout << endl;
- }
- }
- void printMenuTriangle()
- {
- cout << "Chon loai tam giac ma ban muon ve: " << endl;
- cout << "1." << endl;
- TamGiacVuong1(3);
- cout << "2." << endl;
- TamGiacVuong2(3);
- cout << "3." << endl;
- TamGiacVuong3(3);
- cout << "4." << endl;
- TamGiacVuong4(3);
- cout << "5." << endl;
- TamGiacDeuDung(3);
- cout << "6." << endl;
- TamGiacDeuNguoc(3);
- cout << "7. Thoat" << endl;
- }
- void runMenuTriangle(int Cao)
- {
- printMenuTriangle();
- int lenh;
- cin >> lenh;
- system("cls");
- switch (lenh)
- {
- case 1:
- TamGiacVuong1(Cao);
- system("pause");
- break;
- case 2:
- TamGiacVuong2(Cao);
- system("pause");
- break;
- case 3:
- TamGiacVuong3(Cao);
- system("pause");
- break;
- case 4:
- TamGiacVuong4(Cao);
- system("pause");
- break;
- case 5:
- TamGiacDeuDung(Cao);
- system("pause");
- break;
- case 6:
- TamGiacDeuNguoc(Cao);
- system("pause");
- break;
- case 7:
- exit(0);
- default:
- cout << "Vui long nhap lai" << endl;
- system("pause");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement