Advertisement
Shiny_

Untitled

Nov 17th, 2014
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. // ConsoleApplication1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. using namespace std;
  6.  
  7. int _tmain(int argc, _TCHAR* argv[]) {
  8.     double celsius, kelvin;
  9.     double diff = 273.15f;
  10.  
  11.     printf("Wpisz stopnie Celsjusza: ");
  12.     scanf("%lf", &celsius);
  13.     printf("\n%0.2f stopni Celsjusza\n", celsius);
  14.     kelvin = celsius + diff;
  15.     printf("%0.2f stopni Celsjusza = %0.2f stopni Kelvina\n", celsius, kelvin);
  16.  
  17.     printf("Wpisz stopnie Kelvina: ");
  18.     scanf("%f", &kelvin);
  19.     while (kelvin < 0) {
  20.         printf("ŹLE!");
  21.         scanf("%lf", &kelvin);
  22.     }
  23.     printf("\n%0.2f stopni Kelvina\n", kelvin);
  24.     celsius = kelvin - diff;
  25.     printf("%0.2f stopni Kelvina = %0.2f stopni Celsjusza\n", kelvin, celsius);
  26.     system("PAUSE");
  27.     return (0);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement