I would really appreciate if someone could show me how to put thisin a class in
ID: 3618898 • Letter: I
Question
I would really appreciate if someone could show me how to put thisin a class in it's own header file. I am not very good withfunctions and what to pass as parameters. Below is the code and anyhelp would be greatly appreciated. Thanks in advance..The text book i am using is C++ Programming 4th Edition D. S. Malikis the author.
//#include "stdafx.h"
#include <iostream>
using namespace std;
class divByZero { };
const double centi = 2.54;
const int inch = 12;
void main()
{
int feet, inches;
int totalInches;
double centim;
cout << "Enter the value of feet";
cin >> feet;
cout << endl;
cout << "Enter the value of inches";
cin >> inches;
cout << endl;
cout << "You have entered: " << feet<< "for the value of feet and: " << inches <<
"for the value of inches"<< endl;
try
{
if (feet <= 0 || inches<=0)
{
throwdivByZero();
}
else if (isalpha(feet) != 0|| isalpha(inches) !=0)
{
throwdivByZero();
}
else
{
totalInches = inch * feet + inches;
centim =centi * totalInches;
cout<< "Equivalent in centimeters is: "
<< centim << endl;
}
}//end try
catch (divByZero)
{
cout << "Invalidinput!! Enter feet and inches has to be"
"greaterthan zero" << endl;
}
system("pause");
}