diff options
Diffstat (limited to 'sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp')
| -rw-r--r-- | sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp b/sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp new file mode 100644 index 0000000..3519b24 --- /dev/null +++ b/sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp @@ -0,0 +1,22 @@ +#include <iostream> + +int main(){ + float a,c; + int b=1; + std::cout<< " Entrez une temperature en fahrenheit ou en celcius" << std::endl; + std::cin>>a; + std::cout<<"Est ce en fahrenheit (1) ou en celcius(2)?"<<std::endl; + std::cin >> b; + if ( b == 1) { + c = ( a - 32 )* (5.0/9.0); + std::cout<<a << " Fahrenheit vaut " << c << " Celcius"<<std::endl; + } + else if ( b == 2 ) { + c = 9.0/5.0 * a + 32; + std::cout<<a<< " Celcius vaut " << c << " Farhenheit " << std::endl; + } + else { + std::cout<< " Unite incorrecte"<<std::endl; + } + return 0; +} |
