c语言一个无从下手的问题

请大家按以下步骤,创建第二个 C 程序项目。

在你的工作盘上创建命名为“我的数学库”的项目文件夹。

打开Dev-C++,创建名为“Project”的 C 项目,将其保存至“我的数学库”文件夹中。

在项目中创建“MyMath.h”头文件和“MyMath.c”源程序文件。

在“MyMath.h”头文件中声明圆周率 π 和 角度与弧度相互转换函数。

MyMath.h

#define pi 3.1415926535897932384626

double ToAngle(int degree, int minute, double second);
void ToDms(int *degree, int *minute, double *second, double angle);

double ToDegree(double radian);
double ToRadian(double degree);
在“MyMath.c”源程序文件中编写相关函数。

MyMath.c

#include "MaMath.h"

/* 你提交的代码将被嵌在这里 */
清除系统自动生成源程序文件“main.c”的内容,写入以下代码进行全面测试。

main.c

#include <stdio.h>
#include "MyMath.h"

int main()
{
char option;
int d, m;
double s, r;
printf("1. Degree->Radian 2. Radian->Degree 0. Quit > ");
scanf("%d", &option);
if (1 == option)
{
printf("Degree: ");
scanf("%d %d %lg", &d, &m, &s);
printf("Radina: %.10f\n", ToRadian(ToAngle(d, m, s)));
}
else if (2 == option)
{
printf("Radian: ");
scanf("%lg", &r);
ToDms(&d, &m, &s, ToDegree(r));
printf("Degree: %d %d %.2f\n", d, m, s);
}
else if (option)
{
puts("Incorrect option!");
}
return 0;
}
按 F12 键对整个项目中的所有程序文件进行编译并连接,按 F10 键运行程序,检查运行结果是否正确。

关闭工程项目,退出Dev-C++。

运行效果如下:

  1. Degree->Radian 2. Radian->Degree 0. Quit > 1
    Degree: 30 0 0
    Radian: 0.5235987756
  2. Degree->Radian 2. Radian->Degree 0. Quit > 2
    Radian: 0.5235987756
    Degree: 30 0 0.00
  3. Degree->Radian 2. Radian->Degree 0. Quit > 9
    Incorrect option!
    输入样例
    0
    输出样例
  4. Degree->Radian 2. Radian->Degree 0. Quit >