as i have set the max range of x as 2PI i.e 6.28 so in order to move the stars from beggining again i had to set if (x>=6) but on the first cycle it prints 4 stars in the last half cycle then in the next cycle it prints two in the end then 5 ,then 3,then1 how to fix this???
Code:
#include <iostream>
#include <math.h>
#include "myconsole.h"
#include <windows.h>
using namespace std;
int main ()
{
double x,y;
int ax,by;
int counter=0;
ClearScreen ();
for (x=0;x<=6.28;x=x+0.348)// increments x axis by 10 degrees
{
y = sin(x)*10;
ax=(x*10)/1; //stores an integer value
by=(y/1)+15;//magnifies output along y axis
PlaceCursor(ax,by);
cout <<"*";
counter=counter+1;
if (counter%5==0)
{Sleep(1000);
ClearScreen ();
}
if (x>=6)
{
x=0;
}
}