Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, i = 0, j = 0, t;
- cin >> n;
- char a[n][n];
- while (i < n) {
- while (j < n) {
- if (i != (n - 1)/2 && j != (n - 1)/2) {
- if(j == i || j == n - 1 - i) {
- *((char*) a + i*n + j) = '*';
- }
- else {
- *((char*) a + i*n + j) = ' ';
- }
- }
- else {
- *((char*) a + i*n + j) = '*';
- }
- j++;
- }
- j = 0;
- i++;
- }
- i = 0;
- while (i < n) {
- while (j < n) {
- cout << *((char*) a + i*n +j) << " ";
- j++;
- }
- cout << "\n";
- j = 0;
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement