cpp_primer_plus/ch03/03.cpp

19 lines
562 B
C++
Raw Normal View History

2022-08-24 05:44:15 +08:00
# include <iostream>
# include <cmath>
using namespace std;
int conv = 60;
int main(){
int degree, minute, second;
cout << "Enter a latitude in degrees, minutes and second" << endl;
cout << "First, enter the degrees: ";
cin >> degree;
cout << "Next, enter the minutes: ";
cin >> minute;
cout << "Finally, enter the seconds: ";
cin >> second;
float degree_f = degree + minute/float(conv) + second/float(pow(conv,2));
cout << degree << " degrees, " << minute << " minutes, " << second << " seconds = " << degree_f << " degrees" << endl ;
return 0;
}