Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- short unsigned int n;
- cin >> n;
- char array[n][n];
- //fill
- for (int x = 0; x < n; x++) {
- for (int y = 0; y < n; y++) {
- if ((x - y == 0) || ((n - 1) / 2 == y) || ((n - 1) / 2 == x) || (y + x == n - 1))
- {
- array[x][y] = '*';
- }
- else
- {
- array[x][y] = '.';
- }
- }
- }
- //output
- for (int x = 0; x < n; x++) {
- for (int y = 0; y < n; y++) {
- cout<<array[x][y]<<" ";
- }
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement