Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Khisby Al Ghofari, 06.2017.1.06852, Kelas B
- #include <iostream>
- using namespace std;
- int main()
- {
- int heading,bearing;
- cout << "\n=======================================================\n";
- cout << "Welcome To \n";
- cout << "Application Converter Compass Heading to Compass Bearing\n";
- cout << "=========================================================\n \n";
- cout << "Input the degree of compass heading (0 until 360 degree) : ";
- cin >> heading;
- cout << "\nIn compass bearing is ";
- if(heading > 0 && heading <=360){
- if(90 < heading && heading < 270){
- cout << "South ";
- bearing = 180 - heading;
- if(bearing < 0){
- bearing = bearing * -1;
- cout << bearing << "' West";
- }else{
- cout << bearing << "' East";
- }
- }else{
- bearing = heading;
- cout << "North ";
- if(bearing > 0 && bearing <= 90){
- cout << bearing << "' East";
- }else{
- bearing = 360 - heading;
- cout << bearing << "' West";
- }
- }
- }else{
- cout << "Your input is invalid";
- }
- cout << "\n\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement