**MY QUESTION IS BASED ON A COURSEWORK**

I am trying to produce a sin wave using *'s to represent sample values for 1 cycle of the wave. For example when the user enters 7 the output should look like this:

```
.........................................................*
..........................................................................*
..........................................................................*
.........................................................*
.......................................*
.......................................*
.........................................................*
```

please ignore the "......" its the only way i can get the `*`

's to stay where they are

My attempts

To try and get a load of values that can be 'plotted' as `*`

's, i have used a counter to count 0 upto the value the user has entered. leaving me with for this example 1 -> 7 (values to help me split up the sine wave) These values are placed into an array `a[x]`

. Next i have said `a[10]=360/a[x]`

producing equal degree values, 60, 120, 180, 240, 300, 360. Then i have to either convert them to radians before take the sin of them or leave them in degrees(but as this is courswork i need to figure that bit out!)

```
int a[30]; //array called a which has 100 integers
int b[10000];
int x;
for ( x=1; x<=rate-1; x++ ) { //does counting x=1 -> x=rate-1
a[x] = x;
b[0] = (360 / a[x]);
cout << b[0] << endl;}
```

note counter starts at one to avoid 360 / 0*

At the moment my program works in terms of prompting the user to enter a value such as 7 and then working out the degrees for 1 cycle (360).

My problem lies with taking the sin of the values within b[0] which forever produces an overload error. Is there an easier way of showing the degree values for one cycle. I have literally gone through every possibilie i can think off. For example:

```
if ( rate = 7 ) {
int a [7] = { 0, 90, 120, 180, 240, 300, 360 } }
***** AND ALSO ******
for ( x=1; x<=rate-1; x++ ){
a[1] = x;
a[2] = 360 / x;
cout << a[2] << endl;}
a[3] = sin(a[2]);
b[a2] = a[2]; }
****************
```

For all the coding above i am trying to acheive the sine of each of the degree angles so i can put them in the formula below:

```
* output position = centrepoint + scalefactor * sin(radian angle)
```

Can anyone provide me with any tips on how they would calculate and store the degree values so i can use a sin function on them. Something easier than how im going about doing it?

I know this post is confusing but i will explain it again if need be.

Thank you for your time!

*Edited 3 Years Ago by mike_2000_17*: Fixed formatting