Home > Back-end >  Design a sine curve
Design a sine curve

Time:09-17

Design a sinusoidal function, when this function is called, can print out the amplitude, frequency, phase, linear adjustable sine curve, the specific requirements:
1. The amplitude, frequency, phase, linear, respectively is the function of input parameters;
2. Need to have the main function calls the function, the main function only to obtain input parameters of sinusoidal function,
3. Need to have a coordinate axis

CodePudding user response:

Form put a few Edit to input parameter, a drop-down list box to choose form, put an Image control with its Canvas to draw about, drawing method to check the Help of TCanvas class,

CodePudding user response:

#include
#include
using namespace std;

Int main ()
{
Double y;//ordinate
Int I, x, tmpX;

For (y=1; Y & gt;=1; Y=0.1)
{
TmpX=abs (asin (y)) * 10;//10 x magnification
If (y & gt;=0)
{//
the first half of the cycleFor (x=0; X & lt; TmpX; X++)
Cout & lt; <"";
Cout & lt; <"*";

for (; X & lt; 31 - tmpX; X++)
Cout & lt; <"";
Cout & lt; <"*" & lt; }
The else
{
For (x=0; X & lt;=31 + tmpX; X++)//after half a period
Cout & lt; <"";
Cout & lt; <"*";

for (; X & lt;=62 - tmpX; X++)
Cout & lt; <"";
Cout & lt; <"*" & lt; }
}
system("pause");
return 0;
}
  • Related