You are on page 1of 3

//Assignment

//Latitude/departure combination with array (for function)

//Mohamad Haris Bin ABD Azis (2016652132)

//

#include<math.h>

#include<iostream>

using namespace std;

int main ()

const double pi=3.141592654;

double dist,brg,latit,dipat,tita,sec;

int i,stn,deg,min;

char semula;

again :

//Introduction

cout<<"\n------------------------------------------------------------------\n";

cout<<"This programe used to find a Latitudes and Departures";


cout<<"\n--------------------------------------------------------------------";

cout<<"\n";

cout<<"\n";

cout<<"Enter number of survey stn: ";

cin >> stn;

for(i=1;i<=stn;i++)

cout <<"\n";

cout << "\nEnter distance: ";

cin >> dist;

cout << "\nEnter bearing[d|m|s] : ";

//formula ; convert degree min and second ; conversion bearing ; latit and depart

cin >> deg >> min >> sec;

brg=deg+min/60.0+sec/3600.0;

tita=brg*pi/180.0;

latit=dist*cos(tita);

dipat=dist*sin(tita);

//Output for bearing and distance, latit & depart using "cout" function;

cout<<"\n Distance : " <<dist<<"m";

cout<<"\n Bearing : " <<deg<<char(176)<<" "<<min<<"'"<<" "<<sec<<"\"";

cout<<"\n Latitude : " << latit;


cout<<"\n Departure : " << dipat;

cout <<"\nDo you want to continue? [Y/N] : ";

cin >> semula;

if (semula=='Y'||semula=='y')goto again;

else

cout<<"\n";

cout<<"\n\t\t\t----------------------------------------\n";

cout<<"\n\t\t\tThank you for using this programme";

cout<<"\n\t\t\tPlease come again :)";

cout<<"\n\t\t\t----------------------------------------";

cout<<"\n";

cout<<"\n";

system ("pause");

return 0;

return 0;

You might also like