Hey guys,
I made a converter program and i was just wondering how to make it run on its own without debugging it or anything.
So,
Any Help Is Appreciated
Thanks!
If you want my code:
#include <iostream>
#include <time.h>
#include <string>
using namespace std;
float FTC (float);
int main()
{
int a;//Choose What you want to do(Main)
//Currency Rates
int c;//Choose what to convert to(Currency)
float DollarAmount;
float EuroRate = 0.69380;
float PoundRate = 0.60510;
float RupeeRate = 45.2400;
float AusDollarRate = 0.94971;
float YenRate = 76.6102;
float RenminbiRate = 6.38710;
//Volume Conversions
int f;//Choose what to convert to(Volume)
float Liters;
float Cup = 4.22675283770;
float Gallon = 0.26417205236;
float Milliliter = 1000;
float Ounce = 33.8140227010;
float Pint = 2.11337641890;
float Quart = 1.05668820940;
//Length Conversions
int j;//Choose what to convert to(Length)
float Meter;
float Centimeters = 100;
float Kilometers = .001;
float Yards = 1.09;
float Miles = .000621371192;
float Inches = 39.37;
float Feet = 3.28;
//Title and choosing what you want
cout << endl << " Welcome To The TCVL. " << endl;
cout << endl << " The [T]emperature [C]urrency [V]olume [L]ength [U]nit [C]onverter" << endl << endl << endl;
cin.get();
while (1)
{
system("cls");
cout << endl << "What would you like to convert? " << endl;
cout << endl << "1. [T]emperature. " << endl;
cout << endl << "2. [C]urrency. " << endl;
cout << endl << "3. [V]olume. " << endl;
cout << endl << "4. [L]ength. " << endl;
cout << endl << "5. [Q]uit. " << endl;
cout << endl << " ";
cin >> a;
//Temperatures
if (a == 1)
{
system("cls");
float degreesInCelsius;
float degreesInFahrenheit;
cout << " Ok, you want to convert temperatures. " << endl << endl;
cout << " Please enter the temperature in Fahrenheit that you wish to convert: " << endl << endl << " ";
cin >> degreesInFahrenheit;
degreesInCelsius = FTC (degreesInFahrenheit);
cout << endl << " Here is the temperature converted in Celsius: " <<degreesInCelsius << endl << endl << endl;
system("pause");
}
//Currency
else if (a == 2)
{
system("cls");
cout << endl <<" Ok, you want to convert Currency. " << endl;
cout << " Please choose what currency you would like to convert to: " << endl;
cout << endl <<" 1. Euro. " << endl;
cout << endl <<" 2. U.K. Pound. " << endl;
cout << endl <<" 3. Indian Rupee. " << endl;
cout << endl <<" 4. Australian Dollar. " << endl;
cout << endl <<" 5. Japanese Yen. " << endl;
cout << endl <<" 6. Chinese Yuan Renminbi. " << endl << " ";
cin >> c;
if (c == 1)
{
system ("cls");
cout << endl <<" Ok, Euro it is." << endl << endl;
cout << endl <<" Please enter the amount of U.S. Dollars that you would like converted: " << endl << endl << " ";
cin >> DollarAmount;
DollarAmount = DollarAmount * EuroRate;
cout << endl <<" The converted amount in Euros is: " << DollarAmount << endl << endl;
system("pause");
}
else if (c == 2)
{
system ("pause");
system ("cls");
cout << endl <<" Ok, the British Pound it is." << endl << endl;
cout << endl <<" Please enter the amount of U.S. Dollars that you would like converted: " << endl << endl << " ";
cin >> DollarAmount;
DollarAmount = DollarAmount * PoundRate;
cout << endl <<" The converted amount in Pounds is: " << DollarAmount << endl << endl;
system("pause");
}
else if (c == 3)
{
system ("pause");
system ("cls");
cout << endl <<" Ok, the Indian Rupee it is." << endl;
cout << endl <<" Please enter the amount of U.S. Dollars that you would like converted: " << endl << " ";
cin >> DollarAmount;
DollarAmount = DollarAmount * RupeeRate;
cout << endl <<" The converted amount in Rupees is: " << DollarAmount << endl << endl;
system("pause");
}
else if (c == 4)
{
system ("pause");
system ("cls");
cout << endl <<" Ok, Australian Dollar it is." << endl;
cout << endl <<" Please enter the amount of U.S. Dollars that you would like converted: " << endl << " ";
cin >> DollarAmount;
DollarAmount = DollarAmount * AusDollarRate;
cout << endl <<" The converted amount in Australian Dollars is: " << DollarAmount << endl << endl;
system("pause");
}
else if (c == 5)
{
system ("pause");
system ("cls");
cout << endl <<" Ok, Japanese Yen it is." << endl;
cout << endl <<" Please enter the amount of U.S. Dollars that you would like converted: " << endl << " ";
cin >> DollarAmount;
DollarAmount = DollarAmount * YenRate;
cout << endl <<" The converted amount in Yen is: " << DollarAmount << endl << endl;
system("pause");
}
else if (c == 6)
{
system ("pause");
system ("cls");
cout << endl <<" Ok, Chinese Yuan Renminbi it is." << endl;
cout << endl <<" Please enter the amount of U.S. Dollars that you would like converted: " << endl << " ";
cin >> DollarAmount;
DollarAmount = DollarAmount * RenminbiRate;
cout << endl <<" The converted amount in Chinese Yuan Renminbi is: " << DollarAmount << endl << endl;
system("pause");
}
}
//Volume
else if (a == 3)
{
system("cls");
cout << "Ok, converting volume it is." << endl << endl;
cout << "Please choose which one of these you want to convert Liters into: " << endl << endl;
cout << "1. Cup." << endl << endl;
cout << "2. Gallon." << endl << endl;
cout << "3. Milliliter." << endl << endl;
cout << "4. Ounce." << endl << endl;
cout << "5. Pint." << endl << endl;
cout << "6. Quart." << endl << endl << " ";
cin >> f;
cout << endl << endl << endl;
system("cls");
if( f == 1)
{
cout << "Ok, you want to convert to cups." << endl << endl;
cout << "Please input how many liters you want to convert here: " << endl << endl << " ";
cin >> Liters;
Liters = Liters * Cup;
cout << "Here is the converted amount: " << Liters << " cups.";
cout << endl << endl;
system("pause");
}
else if( f == 2)
{
cout << "Ok, you want to convert to gallons." << endl << endl;
cout << "Please input how many liters you want to convert here: " << endl << endl << " ";
cin >> Liters;
Liters = Liters * Gallon;
cout << "Here is the converted amount: " << Liters << " gallons.";
cout << endl << endl;
system("pause");
}
else if( f == 3)
{
cout << "Ok, you want to convert to milliliters." << endl << endl;
cout << "Please input how many liters you want to convert here: " << endl << endl << " ";
cin >> Liters;
Liters = Liters * Milliliter;
cout << "Here is the converted amount: " << Liters << " milliliters.";
cout << endl << endl;
system("pause");
}
else if( f == 4)
{
cout << "Ok, you want to convert to ounces." << endl << endl;
cout << "Please input how many liters you want to convert here: " << endl << endl << " ";
cin >> Liters;
Liters = Liters * Ounce;
cout << "Here is the converted amount: " << Liters << " ounces.";
cout << endl << endl;
system("pause");
}
else if( f == 5)
{
cout << "Ok, you want to convert to pints." << endl << endl;
cout << "Please input how many liters you want to convert here: " << endl << endl << " ";
cin >> Liters;
Liters = Liters * Pint;
cout << "Here is the converted amount: " << Liters << " pints.";
cout << endl << endl;
system("pause");
}
else if( f == 6)
{
cout << "Ok, you want to convert to quarts." << endl << endl;
cout << "Please input how many liters you want to convert here: " << endl << endl << " ";
cin >> Liters;
Liters = Liters * Quart;
cout << "Here is the converted amount: " << Liters << " quarts.";
cout << endl << endl;
system("pause");
}
}
//Length
else if (a == 4)
{
system("cls");
cout << "Ok, you want to convert Length." << endl << endl;
cout << "Please choose which type of Length you want to convert to from Meters" << endl << endl;
cout << "1. Centimeters." << endl << endl;
cout << "2. Kilometers." << endl << endl;
cout << "3. Yards." << endl << endl;
cout << "4. Miles." << endl << endl;
cout << "5. Inches." << endl << endl;
cout << "6. Feet." << endl << endl << " ";
cin>> j;
cout << endl << endl << endl;
system("cls");
if (j == 1)
{
cout << "Ok, you want to convert meters into centimeters." << endl << endl;
cout << "Please enter the amount you want converted here:" << endl << endl << " ";
cin >> Meter;;
Meter = Meter * Centimeters;
cout << "Here is the converted amount: " << Meter << " centimeters." << endl << endl;
system("pause");
}
else if (j == 2)
{
cout << "Ok, you want to convert meters into kiloimeters." << endl << endl;
cout << "Please enter the amount you want converted here:" << endl << endl << " ";
cin >> Meter;;
Meter = Meter * Kilometers;
cout << "Here is the converted amount: " << Meter << " kilometers." << endl << endl;
}
else if (j == 3)
{
cout << "Ok, you want to convert meters into yards." << endl << endl;
cout << "Please enter the amount you want converted here:" << endl << endl << " ";
cin >> Meter;;
Meter = Meter * Yards;
cout << "Here is the converted amount: " << Meter << " yards." << endl << endl;
system("pause");
}
else if (j == 4)
{
cout << "Ok, you want to convert meters into miles." << endl << endl;
cout << "Please enter the amount you want converted here:" << endl << endl << " ";
cin >> Meter;;
Meter = Meter * Miles;
cout << "Here is the converted amount: " << Meter << " miles." << endl << endl;
system("pause");
}
else if (j == 5)
{
cout << "Ok, you want to convert meters into inches." << endl << endl;
cout << "Please enter the amount you want converted here:" << endl << endl << " ";
cin >> Meter;;
Meter = Meter * Inches;
cout << "Here is the converted amount: " << Meter << " inches." << endl << endl;
system("pause");
}
else if (j == 6)
{
cout << "Ok, you want to convert meters into feet." << endl << endl;
cout << "Please enter the amount you want converted here:" << endl << endl << " ";
cin >> Meter;;
Meter = Meter * Feet;
cout << "Here is the converted amount: " << Meter << " feet." << endl << endl;
system("pause");
}
}
//Quit
else if(a == 5)
{
system("cls");
cout << "System Will Now Shut Down!" << endl << endl << endl;
return 0;
}
//False Input
else
{
cout << "Not a valid input...please input again." << endl << endl << " ";
cin >> a;
}
}
return 0;
}
float FTC(float degreesInFahrenheit)
{
float degreesInCelsius = degreesInFahrenheit - 32;
return(degreesInCelsius)*.55;
}