Advertisement
Yozhi522

6.25

Mar 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int minutesPassed(int minute, int hour, int day) {
  8.     return minute + 60 * hour + 1440 * day;
  9. }
  10.  
  11. double celsToFar(double celsius){
  12.     return celsius * 1.8 + 32.0;
  13. }
  14.  
  15. double farToCels(double farenheit){
  16.     return (farenheit -32.0) / 1.8;
  17. }
  18.  
  19. void cToFChart (){
  20.     cout << "Celsius     Farenheit" << endl;
  21.     //setw 4              setw 13
  22.     for(double cels{1.0}; cels <= 100.0; cels++){
  23.         cout << setw(4) << cels << setw(13) << celsToFar(cels) << endl;
  24.     }
  25. }
  26.  
  27. void fToCChart (){
  28.     cout << fixed << setprecision(2);
  29.     cout << "Farenheit     Celsius" << endl;
  30.     //setw 4              setw 13
  31.     for(double far{32.0}; far <= 212.0; far++){
  32.         cout << setw(8) << far << setw(12) << farToCels(far) << endl;
  33.     }
  34. }
  35.  
  36. int main()
  37. {
  38.     fToCChart ();
  39.     //cToFChart();
  40.     //cout << minutesPassed(6, 12, 10);
  41.     //cout << celsToFar(17.0) << endl;
  42.     //cout << farToCels(62.6);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement