fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. const double km_h2m_s = 1000.0/(60*60);
  6. const double km_h2cm_s = km_h2m_s * 100;
  7. const double km_h2in_min = km_h2cm_s / 2.54 * 60;
  8.  
  9. double km_h;
  10. cout << "Wpisz predkosc w km/h: " << flush;
  11.  
  12. if (cin >> km_h) { // Prymitywna obsługa błędów.
  13. cout << endl;
  14. cout << km_h << " km/h = " << km_h * km_h2m_s << " m/s\n";
  15. cout << km_h << " km/h = " << km_h * km_h2cm_s << " cm/s\n";
  16. cout << km_h << " km/h = " << km_h * km_h2in_min << " in/min\n";
  17. }
  18. cout << endl;
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 3476KB
stdin
60
stdout
Wpisz predkosc w km/h: 
60 km/h = 16.6667 m/s
60 km/h = 1666.67 cm/s
60 km/h = 39370.1 in/min