Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <windows.h>
- using namespace std;
- //@author Anwar
- void draw_fanoos(){
- int n, star = 1;
- s:
- system("cls");
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 6);
- cout << "\n Enter a number 'n' (divisible by 4 & n >= 20)...\n";
- cout << " like 20, 24, 28, 32, 36..... : ";
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
- cin >> n;
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
- if(n % 4 || n < 20) {
- cout << "\n\t\t\t Invalid number...\n";
- Sleep(500);
- goto s;
- }
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 13);
- // draw top triangle
- cout << "\n" << string(30, ' ');
- cout << string(n/2 - 1, ' ') << "C\n";
- for(int i = n/2 - 1; i >= 0; i--){
- Sleep(25);
- cout << string(30, ' ');
- cout << string(i, ' ') << string(star, '*') << "\n";
- star += 2;
- }
- // draw middle part
- int tmp = n;
- for(int i = 0; i < n/4; i++)
- {
- Sleep(25);
- if(i == 0){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
- cout << string(30, ' ');
- cout << '\\' << string((n - 17) / 2, ' ');
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 176);
- cout << "RAMADAN KAREEM";
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
- cout << string((n - 17) / 2, ' ') << "/\n";
- tmp--;
- continue;
- }
- cout << string(30, ' ');
- cout << string(i, ' ') << '\\' << string(tmp - 3 - i, ' ') << "/\n";
- tmp--;
- }
- // draw bottom part
- star = n/2 - 1;
- for(int j = n/4; j >= 1; j--){
- Sleep(25);
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
- cout << string(30, ' ');
- cout << string(j, ' ') << string(star, '*') << "\n";
- star += 2;
- }
- cout << "\n";
- }
- int main()
- {
- char c;
- do {
- system("cls");
- draw_fanoos();
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
- cout << "\t\t\t Want to try again? (Y/N): ";
- cin >> c;
- } while(tolower(c) != 'n');
- return 0;
- }
Add Comment
Please, Sign In to add comment