Программа вводит и выводит координаты широты и долготы
в градусах и минутах.
//------------------------------------------------------------------------------------------------
#include <iostream>
#include <conio.h>
using namespace std;
//--------------------------------------------
class angle
{
private:
int gradus;
float min;
char ch;
public:
angle(int gr, float mn, char c): gradus(gr), min(mn), ch(c)
{}
void setcord()
{
cout<<"\nEnter the gradus: "; cin>>gradus;
cout<<"Enter the minute: "; cin>>min;
cout<<"Enter the napravlenie (N, S, E, W): "; cin>>ch;
}
void display()const
{
cout<<gradus<<'\xF8'<<min<<"'"<<ch;
}
};
//-----------------------------------------------------
class coordinata
{
private:
angle wirota;
angle dolgota;
public:
coordinata(int g1, float m1, char e1, int g2, float m2, char e2): wirota(g1,
m1, e1), dolgota(g2, m2, e2)
{}
void set()
{
cout<<"\nEnter the W I R O R A: ";
cout<<endl<<"[izmnyatnsya ot 0 do 90 gradusov]\n";
wirota.setcord();
cout<<"\nEnter the D O L G O T A: ";
cout<<endl<<"[izmnyatnsya ot 0 do 180 gradusov]\n";
dolgota.setcord();
}
void cdisplay()
{
cout<<"\n\nY O U C O O R D I N A T E:"<<endl<<endl;
cout<<"\nWirota: ";
wirota.display();
cout<<"\nDolgota: ";
dolgota.display();
cout<<endl;
}
};
//------------------------------------------------------
int main()
{
coordinata cool(121, 18, 'W', 139, 24, 'S');
cool.cdisplay();
char sic='q';
while(sic!='n')
{
cool.set();
cool.cdisplay();
cout<<"If you whant continue? (y/n): ";
cin>>sic;
}
return 0;
}
//------------------------------------------------------------------------------------------------