?? 7iv.cpp
字號:
// drawcos.cpp Plot the cosine function horizontally on the
// screen for angles from 0 to 3p.
#include <iostream.h>
#include <math.h>
// PlotPoint () Plot the cosine of the angle parameter
// on a line across the screen
// IN: angle -- the angle in radians to be plotted
void PlotPoint (float angle)
{ int blanks, position;
position = cos (angle) * 35 + 35;
for (blanks=0; blanks<position; blanks=blanks+1)
cout << " ";
cout << "*" << endl;
}
// PlotYAxis() draw a Y axis and fiducial marks on screen
void PlotYAxis()
{ cout << " -1.0 0.0 1.0" << endl;
cout << "--------------------------|----------------------" << endl;
}
void main ()
{ float angle;
const float anglestep = 0.1885; // 3p / 50
const float limit = 9.42478; // 3p
PlotYAxis(); // draw the Y axis
// plot a point for each angle from 0 to 3p in steps of 3p/50
for (angle=0.0; angle<limit; angle=angle+anglestep)
PlotPoint (angle);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -