#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <conio.c>
#include <iomanip.h>
class espiral{
private:
int g;
int b;
int f;
public:
void ingresadatos(int x){
b=x;
int r=b%4;
int c=b/4;
switch(r){
case 0:
cout<<"( "<<-c<<" , "<<-c<<" )"<<endl; break;
case 1:
cout<<"( "<<c+1<<" , "<<-c<<" )"<<endl; break;
case 2:
cout<<"( "<<c+1<<" , "<<(c+1)<<" )"<<endl; break;
case 3:
cout<<"( "<<-(c+1)<<" , "<<c+1<<" )"<<endl; break;
}
}
void ingresacoord(int m,int n){
g=m;
f=n;int d;
if(g<=0&&f<=0&&g==f){
d=g*(-4);
cout<<"vertice "<<d<<endl;
}
else{
if(g+f==1){
d=g*4-3;
cout<<"vertice "<<d<<endl;
}
else{
if(g==f&&g>0&&f>0){
d=f*4-2;
cout<<"vertice "<<d<<endl;
}
else{
if(f+g==0){
d=-(g*4)-1;
cout<<"vertice "<<d<<endl;}
else
cout<<"Coordenada no valida"<<endl;
}
} }
}
};
void main()
{
espiral *m;
m=new espiral;
m->ingresadatos(0);//algunos ejemplos
m->ingresadatos(1);
m->ingresadatos(2);
m->ingresadatos(3);
m->ingresadatos(4);
m->ingresadatos(5);
m->ingresacoord(0,0);
m->ingresacoord(1,0);
m->ingresacoord(1,1);
m->ingresacoord(-1,1);
m->ingresacoord(-1,-1);
m->ingresacoord(2,-1);
system("PAUSE");
return 0;
}