Skip to content

Instantly share code, notes, and snippets.

@mahata
Created September 13, 2011 00:00
Show Gist options
  • Save mahata/1212815 to your computer and use it in GitHub Desktop.
Save mahata/1212815 to your computer and use it in GitHub Desktop.
C++ Primer 3.3
#include <iostream>
int main() {
using namespace std;
cout.setf(ios_base::fixed, ios_base::floatfield);
int degree, minute, second;
cout << "Enter a latitude in degrees, minutes, and seconds:" << endl;
cout << "First, enter the degrees: ";
cin >> degree;
cout << "Next, enter the minutes of arc: ";
cin >> minute;
cout << "Finally, enter the seconds of arc: ";
cin >> second;
cout << degree << " degrees, " << minute << " minutes, " << second << " seconds = ";
cout << double(degree + ((minute + (second / 60.0)) / 60.0));
cout << " degrees" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment