Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

Unit Converter :: Beta Version

Posted by Circuit Negma on January 18, 2006


There are bugs to be worked out.
// ************************************************************************
// * Created By: Circuit Negma                                            *
// * Date      : Jan 1 , 2006                                             *
// * File Name : converter                                                *
// * Description :                                                        *
// * THIS IS a general metric converter                                   *
// ************************************************************************

// SEC. 1: PRE-PROCESSOR DIRECTIVES
// Library - is a collection of functions and symbols that are needed to run
//           C++ program.
// Library - has a name and is referred to by a header file.

#include <iostream>   // Input/Output functions are contained in the header
                        // file iostream.h
                        // The header file contain the needed instructions and
                        // descriptions of the functions needed to perform input
                        // output operations.

using namespace std;

float check(float n)
{
 float i;
 bool flag;
 
 //flag = isfloat(n);
 
 return i;
}

void cmConv (float n)
{
     float iin, ift;
     
     cout << endl << endl;
     cout << " cmConv has been chosen" << endl;
     iin = n * 0.394;
     ift = n * 0.0328;
     cout << iin << " in" << endl;
     cout << ift << " ft" << endl;
}

void inchConv (float n)
{
      float incm, inft;
     
     cout << endl << endl;
     cout << " inchConv has been chosen" << endl;
     incm = n / 0.394;
     inft = (n * 0.0328) / 0.394;
     cout << incm << " cm" << endl;
     cout << inft << " ft" << endl;

}

void ftConv (float n)
{
     float ftcm, ftin;
     
     cout << endl << endl;
     cout << " ftConv has been chosen" << endl;
     ftcm = n / 0.0328;
     ftin = (n * 0.394) / 0.0328;
     cout << ftcm << " cm" << endl;
     cout << ftin << " in" << endl;
} 


int main()
{
    cout.flush();
    
    int i;
    float icm, iin, ift;
    string flag;
    
    cout << " _____________________________" << endl << endl;
    cout << " - Created By: Circuit Negma -" << endl;
    cout << " - File Name : Converter.cpp -" << endl;
    cout << " - Date      : Jan 17, 2006  -" << endl;
    cout << " _____________________________" << endl;
    cout << endl << endl;
main_face:    
    cout << " _________________________________"  << endl;
    cout << "|                                 |" << endl;
    cout << "| Welcome to C++                  |" << endl;
    cout << "|                                 |" << endl;
    cout << "| Metric Calculator Menu          |" << endl;
    cout << "|___________________________      |" << endl;
    cout << "|                                 |" << endl;
    cout << "| 1. Convert from 'cm' to ...     |" << endl;
    cout << "| 2. Convert from 'inch' to ...   |" << endl;
    cout << "| 3. Convert from 'ft' to ...     |" << endl;
    cout << "| 4. Exit Sat. Link System.       |" << endl;
    cout << endl;
    cout << " Please, Chose from the Menu: ";
    cin  >> i;
    cout << endl;
    
    if ( i == 1 )
    {
         cout << "You chosed to convert from 'cm' to ... " << endl;
         cout << "Please, Enter the amount in 'cm':  ";
         cin >> icm;
         cmConv(icm);
         cout << endl << endl;
         goto main_face;
    }
    else if (i == 2)
    {
         cout << "You chosed to convert from 'inch' to ... " << endl;
         cout << "Please, Enter the amount in 'inch':  ";
         cin >> iin;
         inchConv (iin);
         cout << endl << endl;
         goto main_face;
    }
    else if (i == 3)
    {
         cout << "You chosed to convert from 'ft' to ... " << endl;
         cout << "Please, Enter the amount in 'ft':  ";
         cin >> ift;
         ftConv (ift);
         cout << endl << endl;
         goto main_face;
    }
    else if (i == 4)
    {
             cout << "Exit Sat. Link System.";
             
    }
    else
    {
        cout << "exit";
        return(0);
    }
    
    //cin >> i;
    return 0;
}



One Response to “Unit Converter :: Beta Version”

  1. niusonblox said

    Here are some links that I believe will be interested

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: