Code:
/* This program wlil graph an increasing frequency sine wave */
#include <stdio.h> /* printf, scanf definitions */
#include <math.h> /* math definitions */
#define pi 3.14159
int
main(void)
{
double stepsize; /* input - stepsize */
double first_value; /* input - first value */
double number_of_lines; /* input - number of lines */
double output;
double loop;
double scale;
double increment;
double y;
double sin;
/* Get the step size, first value, and number of lines */
printf("Enter the inial step size> ");
scanf("%d", &stepsize);
printf("Enter the first value> ");
scanf("%d", &first_value);
printf("Enter the number of lines> ");
scanf("%d", &number_of_lines);
for (int i = 0; i<number_of_lines; ++i)
{
double y = sin(exp(first_value + i * stepsize * 2 * pi / 180));
y *= 10.0; /* Scaling */
y += 5.0; /* Scaling */
/* Output y spaces by using loop */
for (int j = 0; j < y; ++j)
{
printf(" ");
}
printf("*\n"); /* Output '*' and new line) */
}
return 0;
}
code tags added by Kermi3
i'm still getting these error messages...
sine.c: In function `main':
sine.c:28: error: `for' loop initial declaration used outside C99 mode
sine.c:30: error: called object is not a function
sine.c:35: error: `for' loop initial declaration used outside C99 mode[SIZE=5]