Answer:
The C code is below.
Explanation:
#define amplitude 1
02 #define b 1
03 #define c 200
04 class Sinewave
05 {
06 protected:
07
08 double freq;
09 int y;
10
11 public:
12 Sinewave()
13 {
14
15 }
16 void generateSinewave()
17 {
18 COLORREF yellow = RGB(255,255,0);
19 COLORREF lightblue = RGB(173,216,230);
20
21 // make sure the names match
22 SetConsoleTitle(L"ConGraphics");
23 HWND hWnd = FindWindow(NULL, L"ConGraphics");
24 HDC hDC = GetDC(hWnd);
25
26 //for(int x = 0; x < freq; x++)
27 for(int x = 0;; x++)
28 {
29 // center at y = 200 pixels
30
31 y = amplitude*(int)(sin(x/100.0)*100 + 150);
32 SetPixel(hDC, x, y, lightblue);
33
34
35 }
36
37 }
38 };