float q = 0;
float r = 320;
float rr = r;
int flagq = 1;
int flagr = 1;
int intr ;
int intq;
for (int i = 0; i < 400 ;i++)
{
intr = r;
if (r == 80)
{
flagr = -1;
}else if (r == 320 )
{
flagr = 1;
}
intq = q;
if( intq == -55)
{
flagq = 1;
}else if(intq == 55)
{
flagq = -1;
}
r = r - flagr*(q/60);
q = q + flagq*(60 - q)/60;
cout << "r = "<< r << " q = " << q <<endl;
}