Inch to Centimeter

This is the solution to convert Inch into Centimeter

#include <iostream>

using namespace std;

class InchtoCentimeter
{
    float Inch, Centimeter ;
public:

    void GetInch();
    void Conversion();
    void print();
};


void InchtoCentimeter::GetInch()
{
    cout << endl << "Enter inch:" ;
    cin >> Inch ;
}

void InchtoCentimeter::Conversion()
{
    Centimeter = 2.54*Inch ;
}

void InchtoCentimeter::print()
{
    cout << endl << "Inch=" << Inch << endl << "Centimeter=" << Centimeter << endl ;
}

int main()
{
    InchtoCentimeter d;
    d.GetInch();
    d.Conversion();
    d.print();
    return 0;
}

No comments:

Post a Comment