#include <stdio.h>
#include <math.h>
void plotline (float y)
{
char c='@';
if (x==0.0)
printf("%c\n",c);
else if (x==1.0)
printf("%41c\n",c);
}
void plot ()
{
float y,x;
for (x=0.0;x<=3.2;x+=0.2)
{
y=sin(x)*sin(x);
plotline(y);
}
}
void main()
{
plot();
}
I'm trying to print the graphic curve of sin^2(x) based on some given values on my plot but I'm getting this output so far,
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
I want want the first @ to be diplayed on 0,0 and then each sum to print another at sign (@) to make it look like the sin^2(x) curve. I'm currently trying to fix it using a two dimensional array but it doesnt seem to work either.
expected output
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@