Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <iostream.h>
- #include <stdio.h>
- int main ()
- {
- int n,m,i,j,temp;
- cout<<"n=";
- cin>>n;
- cout<<"\n";
- char a[n][n];
- setlocale (LC_CTYPE, ".1251");
- //Генерируем квадратный массив и выводим его
- for(i=0; i<n; i++)
- {
- for(j=0; j<n; j++)
- {
- if(((j-(n-1)/2)*(j-(n-1)/2)+(i-(n-1)/2)*(i-(n-1)/2)<=(n-1)*(n-1)/4 && j>=(n/1/2)) || ((i<=j/2+(n-1)/2)&&(i>=-j/2+(n-1)/2)) && j<=(n-1)/2)
- a[i][j] = '*';
- else
- a[i][j] = ' ';
- }
- }
- for(i=0; i<n; i++)
- {
- for(j=0; j<n; j++)
- cout<<a[i][j];
- cout<<"\n";
- }
- getch ();
- return 0;
- }
Add Comment
Please, Sign In to add comment