Here is what I have for my complete code, so far. If I make my funtions const I get errors.
Code:
//location.h
class location
{
private:
int degrees;
int minutes;
int seconds;
public:
location(int d, int m, int s);
~location();
void setdegrees(int d);
void setminutes(int m);
void setseconds(int s);
int getdegrees();
int getminutes();
int getseconds();
void properties();
};
//location.cpp
#include<iostream>
#include"location.h"
using namespace std;
location::location(int d, int m, int s)
{
degrees = d;
minutes = m;
seconds = s;
}
location::~location()
{
}
void location::setdegrees(int d)
{
degrees = d;
}
void location::setminutes(int m)
{
minutes = m;
}
void location::setseconds(int s)
{
seconds = s;
}
int location::getdegrees()
{
return degrees;
}
int location::getminutes()
{
return minutes;
}
int location::getseconds()
{
return seconds;
}
void location::properties()
{
cout<<" Degrees"<<getdegrees() <<endl;
cout<<" Minutes"<<getminutes() <<endl;
cout<<" Seconds"<<getseconds() <<endl;
}
//main
#include"location.h"
#include<iostream>
int main(int argc, char *argv[])
{
location city(51, 30, 0);
city.properties();
system("PAUSE");
return 0;
}
This is only giving lat or lon. Not both.