summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp
blob: 3519b24555e60d79634b23d60ce93f2b3ae8aa7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
}