cpp_primer_plus/ch03/03.cpp
2022-08-23 23:01:08 +01:00

18 lines
562 B
C++

# 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;
}