Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

flag of georgia

#include <iostream>
using namespace std;
 
int main() {
	
	int k;
	cin >> k;
    int n = 4 * k + 14;
    

		/**
		* to set cross inside squeres we should identifu 1/4 point and after that the another starts will below, above, right and left from it 
		*/

		//first half
    for (int i = 0; i < n / 2; i++) {
        if (i == 0 || i == n / 2 - 1) {
            for (int j = 0; j < n; j++) {
                cout << "*";
            }
        } else {
            for(int j = 0; j < n; j++) {
                if (j == 0 || j == n - 1 || j == n/2 || j == n/2 - 1) {
                    cout << "*";
                } else if (i == n/4 && (j == n/4 || j == 3 * n/4 || j == n/4 - 1 || j == n/4 + 1 || j == 3 * n/4 - 1 || j == 3 * n/4 +1)) {
                    cout << "*";
                } else if (i == n/4 -1 && (j == n/4 || j == 3 * n/4)) {
                    cout << "*";
                } else if (i == n/4 + 1 && (j == n/4 || j == 3 * n/4)) {
                    cout << "*";
                } else {
                    cout << " ";
                }
            }
        }
        cout << endl;
    }
		//second half
    for (int i = 0; i < n / 2; i++) {
        if (i == 0 || i == n / 2 - 1) {
            for (int j = 0; j < n; j++) {
                cout << "*";
            }
        } else {
            for(int j = 0; j < n; j++) {
                if (j == 0 || j == n - 1 || j == n/2 || j == n/2 - 1) {
                    cout << "*";
                } else if (i == n/4 && (j == n/4 || j == 3 * n/4 || j == n/4 - 1 || j == n/4 + 1 || j == 3 * n/4 - 1 || j == 3 * n/4 +1)) {
                    cout << "*";
                } else if (i == n/4 -1 && (j == n/4 || j == 3 * n/4)) {
                    cout << "*";
                } else if (i == n/4 + 1 && (j == n/4 || j == 3 * n/4)) {
                    cout << "*";
                } else {
                    cout << " ";
                }
            }
        }
        cout << endl;
    }
 
	return 0;
}
Source by smart.ibsu.edu.ge #
 
PREVIOUS NEXT
Tagged: #flag #georgia
ADD COMMENT
Topic
Name
6+8 =