/* Uzunluk Ölçümleri birim dönüşümü yapan program. */
#include <iostream> // cout,cin,endl
#include <stdlib.h> // EXIT_SUCCESS,EXIT_FAILURE
using namespace std;
int main(void)
{
int choice;
float in, ft, yd, mil, dmil, m; // in:inch ft:foot yd:yarda mil:mil dmil:deniz mili m:metre
cout << "1. INCH........- metre" << endl;
cout << "2. FOOT........- metre" << endl;
cout << "3. YARDA.......- metre" << endl;
cout << "4. MIL.........- metre" << endl;
cout << "5. DENIZ MILI..- metre" << endl;
cout << "6. Cikis" << endl;
cout << "Seciminiz:" << endl;
cin >> choice;
switch (choice)
{
case 1:
cout << "inch cinsinden uzunluk giriniz: ";
cin >> in;
m = in * .0254;
cout << m << " metre" << endl; // kota içindeki cm'ye katar denir.
break; // switch komutundan çıkar.
case 2:
cout << "foot cinsinden uzunluk giriniz: ";
cin >> ft;
m = ft * .3048;
cout << m << " metre" << endl;
break;
case 3:
cout << "yarda cinsinden uzunluk giriniz: ";
cin >> yd;
m = yd * .9144;
cout << m << " metre" << endl;
break;
case 4:
cout << "mil cinsinden uzunluk giriniz: ";
cin >> mil;
m = mil * 1609.34;
cout << m << " metre" << endl;
break;
case 5:
cout << "deniz mili cinsinden uzunluk giriniz: ";
cin >> dmil;
m = dmil * 1852;
cout << m << " metre" << endl;
break;
case 6:
return EXIT_SUCCESS;
default:
cout << "Boyle bir islem yok." << endl;
system ("pause");
return EXIT_FAILURE;
}
system ("pause"); // prog bittikten sonra sistemi bekletir.
return EXIT_SUCCESS;
}