#include <conio.h>
#include<iostream>
#include <stdlib.h>
#include<time.h>
using namespace std;
int main()
{
srand(time(0));
int a;
char ch;
do
{
system("cls");
cout<<"yek adade fard vared konid : ";
cin>>a;
while(a%2==0)
{
cout<<"\nadad bayad fard bashad : ";
cin>>a;
}
int **x;
x=new int *[a];
for(int i=0;i<a;i++)
x[i]=new int [a];
for(int i=0;i<a;i++)
for(int j=0;j<a;j++)
x[i][j]=0;
int i=0;int j=((a-1)/2);
for(int k=1;k<=(a*a);k++)
{
///////////////////////
if(i>=a)
i=i-a;
if(j>=a)
j=j-a;
if(i<0)
i=i+a;
if(j<0)
j=j+a;
//////////////////////
if(x[i][j]!=0)
{
i=i+2;
j++;
}
///////////////////////
if(i>=a)
i=i-a;
if(j>=a)
j=j-a;
if(i<0)
i=i+a;
if(j<0)
j=j+a;
///////////////////////
x[i][j]=k;
i--;
j--;
}
cout<<"\n";
for(int i=0;i<a;i++)
{
for(int j=0;j<a;j++)
cout<<x[i][j]<<" ";
cout<<"\n\n";
}
cout<<"edame midahid? yes(y) ya no(n) : ";
cin>>ch;
cout<<"\n";
}while(ch=='y');
getch();
return 0;
}
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include <stdio.h>
#include <math.h>
using namespace std;
main() {
int i;
double a;
a=120;
for (i=1;i<=10;i++)
a=0.8*a;
cout<<a<<"milion";
getch();
}
[URL="http://www.irysc.com/forum/usertag.php?do=list&action=hash&hash=include"]#include[/URL] <iostream>
[URL="http://www.irysc.com/forum/usertag.php?do=list&action=hash&hash=include"]#include[/URL] <stdlib.h>
[URL="http://www.irysc.com/forum/usertag.php?do=list&action=hash&hash=include"]#include[/URL] <time.h>
[URL="http://www.irysc.com/forum/usertag.php?do=list&action=hash&hash=include"]#include[/URL] <conio.h>
[URL="http://www.irysc.com/forum/usertag.php?do=list&action=hash&hash=include"]#include[/URL] <stdio.h>
[URL="http://www.irysc.com/forum/usertag.php?do=list&action=hash&hash=include"]#include[/URL] <math.h>
using namespace std;
main() {
int i;
double a;
a=120;
for (i=1;i<=10;i++)
a=0.8*a;
cout<<a<<"milion";
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
main() {
int i;
double a=120;
a=120;
for (i=1;i<=10;i++)
a*=0.8;
cout<<a<<"million";
getch();
return 0;
}
#include <iostream>
#include <conio.h>
using namespace std;
main() {
int i;
double a=120;
a=120;
for (i=1;i<=10;i++)
a*=0.8;
cout<<a<<"million";
getch();
return 0;
}
#include <iostream>
#include <conio.h>
#include <math.h>
using namespace std;
main() {
double a=120;
cout<<a*pow (0.8,10)<<"milion";
getch ();
}