summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP/TP5-6/ex13/ex13.cpp
blob: d61c5b028a1a211319f25c8f5d32a12277aaae81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>

int main () {
  int x;
  float y;
  int *ptr;
  float *ptr2;
  std::cout<<" Entrez un nombre entier" << std::endl;
  std::cin>>x;
  ptr=&x;
  ptr2 = (float*)ptr;

  std::cout<<"L'entier "<< x << " vaut " << *ptr2 << " en interpretation flottante" << std::endl;
  std::cout<<" Entrez un nombre flottant" << std::endl;
  std::cin>>y;
  ptr2 = &y;
  ptr = (int*)ptr2;
  std::cout<<"Le flottant "<< y << " vaut " << *ptr << " en interpretation entiere" << std::endl;
  return 0;
}