Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- double temp_wej, temp_wyj, x, y;
- int main()
- {
- cout<<"Jaka temperature chcesz przeliczyc? 1 Celsjusz, 2 Fahrenheit, 3 Kelvin"<<endl;
- cin>>temp_wej;
- cout<<"Podaj wartość temperatury"<<endl;
- cin>>x;
- cout<<"Na jaką temperature przeliczasz ? 1 Celsjusz, 2 Fahrenheit, 3 Kelvin"<<endl;
- cin>>temp_wyj;
- if( temp_wej == temp_wyj )
- {
- y = x;
- cout<<"Temperatura po przeliczeniu wynosi "<<y<<endl;
- }
- else if ( temp_wej==1 and temp_wyj==2)
- {
- y = ( x * 1.8 ) + 32;
- cout<<"Temperatura w Fahrenheitach wynosi "<<y<<endl;
- }
- else if ( temp_wej==1 and temp_wyj==3)
- {
- y = x + 273.15;
- cout<<"Temperatura w Kelvinach wynosi "<<y<<endl;
- }
- else if ( temp_wej==2 and temp_wyj==1)
- {
- y = ( x - 32 ) / 1.8;
- cout<<"Temperatura w Celsjuszach wynosi "<<y<<endl;
- }
- else if ( temp_wej==2 and temp_wyj==3)
- {
- y = ( x + 459.67 )*5/9;
- cout<<"Temperatura w Kelvinach wynosi "<<y<<endl;
- }
- else if ( temp_wej==3 and temp_wyj==1)
- {
- y = x - 273.15;
- cout<<"Temperatura w Celsjuszach wynosi "<<y<<endl;
- }
- else if ( temp_wej==3 and temp_wyj==2)
- {
- y = ( x * 1.8 ) - 459.67;
- cout<<"Temperatura w Fahrenheitach wynosi "<<y<<endl;
- }
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement