C++ Primer Plus P23 编程题三(编写程序,实现维度的转换)——中职

本篇博客介绍了一道C++ Primer Plus P23的编程题目,要求用户输入纬度的度、分、秒,然后将其转换并以度为单位显示。通过使用符号常量表示角度和弧度的关系,程序将各个输入值分别存储,并提供了计算公式及示例输出。
摘要由CSDN通过智能技术生成

C++ Primer Plus P23 编程题三

编写一个程序,要求用户以度、分、秒的方式输入一个纬度,然后以度为单位显示该纬度。
1°等于60’,1’等于60",请以符号常量表示这些值。对于每个输入值,应使用一个独立的变量存储它。

1°等于60’,1’等于60"

下面是该程序运行时的输出:
Enter a latitude in degrees, minutes, and secounds:
First, enter the degree:37
Next, enter the minutes of arc:51
Finally, enter the secounds of arc:19
37 degrees, 51 minuts, 19 secounds = 37.8553 degress

/*
C++ Primer Plus P23 编程题三

编写一个程序,要求用户以度、分、秒的方式输入一个纬度,然后以度为单位显示该纬度。
1°等于60',1'等于60",请以符号常量表示这些值。对于每个输入值,应使用一个独立的变量存储它。

1°等于60',1'等于60"

下面是该程序运行时的输出:
Enter a latitude in degrees, minutes, and secounds:
First, enter the degree:37
Next, enter the minutes of arc:51
Finally, enter the secounds of arc:19
37 degrees, 51 minuts, 19 secounds = 37.8553 degress
*/

//头文件
#include<iostream>

//转换因子
const int DEGREE_TO_MINUTE = 60;											//分转度的转换因子
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值