You are on page 1of 1

#include<iostream.

h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
int main(void)
{
int gdriver = DETECT, gmode;
float x,w1,w,a,f,fs;
cout<<"\n\tEnter amplitude:";
cin>>a;
cout<<"\n\tEnter freq.:";
cin>>f;
cout<<"\n\tEnter sampling points:";
cin>>fs;
w=2*3.14*f;
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
line(0, 0,0,500);
line(0,200,800,200);
// getch();
for(int n=0;n<640;n++)
{
w1=w*n;
x=a*sin(w1/fs);
x=x+200;
putpixel(n,x,25);
}
getch();
closegraph();
return 0;
}

You might also like