Yeah, I trimmed out some of the fat, as well as those two and got it...well I don't wanna say half working, but now I am even more confused on what happened.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
else if (choice == 2)
{
{
for (int t=0; t < 180; t +=4)
{
double ans;
double ans2;
int final;
ans = t * (3.14) / (180);
ans2 = sin(ans);
final = (int)(80.0 * ans2);
while (x < final)
{
x = x+1;
cout << " ";
}
cout << "*" << endl;
}
}
return 0;
}
}
|
And the output it gives me looks something like this:
*
.....*
.........*
.........*
............*
........*
........*
.......*
..... *
.....*
*
*
*
*
*
*
*
*
The thing is, it is supposed to be roughly 45 lines, out to a potential of 80 spaces. I got it to give me the numbers it was using and I got:
0, 5, 11, 16, 22 etc etc etc, up to just shy of 80, where it then turned around and went back towards zero. So it is behaving like a Sine wave should mathematically, but I still am lost as to why it starts to shift at the start, and then sort of dies.