#include <iostream>
#include <string>
using namespace std;
class Distance{
private:
int kilometres;
public:
//Distance which has parameters as kilometres
Distance(int kilometres){
this->kilometres=kilometres;
}
double convertKilometresToMiles(){
return this->kilometres* 0.621;
}
};
int main()
{
int kilometres;
cout<<"Enter kilometres: ";
cin>>kilometres;
Distance distance(kilometres);
cout<<"Miles: "<<distance.convertKilometresToMiles()<<"\n";
cin>>kilometres;
return 0;
}
Comments
Leave a comment