Sunday, April 29, 2018

Length Conversion in C++

A very simple program written in C++ the will compute the different length conversion using functions and pointers.

I am currently accepting programming work, it project, school programming projects , thesis and capstone projects, IT consulting work and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.


Program Listing

convert.cpp

#include <iostream>
#include <stdlib.h>

using namespace std;

void getval(int& feet,int& inch);
void convert(int& ftom,int& itocm);
void show(int& show1,int& show2);

int main()
{
    int x,y;
    getval(x,y);
    convert(x,y);
    show(x,y);
    system("PAUSE");
    return 0;
}

void getval(int& feet,int& inch)
{
     cout << "Length Conversion in C++";
cout << "Enter length in feet: ";
     cin >> feet;
     cout << " and in inches: ";
     cin >> inch;
}

void convert(int& ftom,int& itocm)
{                                         
     double mt;
     int fmt,fcm;
     
     mt=((ftom*12)+itocm)*2.54;
     fmt=mt;
     fcm=fmt%100;
     fmt=(fmt-fcm)/100;
     ftom=fmt;     
     itocm=fcm;
}

void show(int& show1,int& show2)
{
     cout << "\n\nThat is: " << show1 << " m & " << show2 << "cm\n\n";
}







No comments:

Post a Comment