输入正弦函数的各个数据求周期等
/* 版本:1.0 作者:韩耿
完成时间:2007.8.19
程序描述:
输入正弦函数的各个数据
求:
1周期
2值域
3振幅
4频率
*/
#include "stdio.h"
#include "math.h"
main()
{
/*定义变量*/
float A=0;
float W=0;
float O=0;
float H=0;
float T=0;
float Max=0;
float Min=0;
float f=0;
/*输入欢迎语*/
printf("Welcome to use my computer programmer!\n");
printf("The computer programmer is made by Hangeng!\n");
printf("Y=A(Wx+o)+H\n\a");
/*输入常量*/
/*输入A*/
printf("Please input A!\n");
printf("A=");
scanf("%f",&A);
printf("A=%f\n",A);
/*输入W*/
printf("Please input W!\n");
printf("W=");
scanf("%f",&W);
printf("W=%f\n",W);
/*输入O*/
printf("Please input O!\n");
printf("O=");
scanf("%f",&O);
printf("O=%f\n",O);
/*输入H*/
printf("Please input H!\n");
printf("H=");
scanf("%f",&H);
printf("H=%f\n",H);
/*进行计算*/
/*计算周期*/
W=abs(W);
T=(2*3.1415926)/W;
/*计算值域*/
Max=A+H;
Min=-A+H;
/*计算频率*/
f=1/T;
/*计算振幅*/
A=A;
/*输出结果*/
printf("The period is %f\n",T);
printf("The maximum is %f\n",Max);
printf("The minimum is %f\n",Min);
printf("The amplitude of vibration is %f\n",A);
printf("The frequency is %f\n",f);
/*完成*/
printf("Thank you !");
getch();
}