Advertisement
idsystems

Cpp_Practica18 - Metros

Jan 26th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. // Program: metros2todos.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6. #include <iomanip>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.    float x, centimetros, pulgadas, pies, yardas;
  13.  
  14.    cout << "Conversor" << endl;
  15.    cout << "=========" << endl;
  16.  
  17.    cout << "Ingrese una distancia en metros= "; cin >> x;
  18.  
  19.    centimetros = x * 100;
  20.    pulgadas = centimetros / 2.54;
  21.    pies = pulgadas / 12;
  22.    yardas = pies / 3;
  23.  
  24.    cout.setf(ios::fixed);
  25.    cout << setprecision(2) << endl;
  26.  
  27.    cout << x << " metros equivalen a " << centimetros << " centimetros" << endl;
  28.    cout << x << " metros equivalen a " << pulgadas << " pulgadas" << endl;
  29.    cout << x << " metros equivalen a " << pies << " pies" << endl;
  30.    cout << x << " metros equivalen a " << yardas << " yardas" << endl;
  31.  
  32.    return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement