* affichage d'un reel en style electronicien
      subroutine printelec(texte, x)
      character*(*) texte
      character*60 bout
      real x

      call metbout(texte, bout, x)
      write (6,*) bout
      return
      end


* Idem avec 2 r?els
      subroutine printelec2(texte, x, texte2, y)
      implicit none
      character*(*) texte, texte2
      real x, y
      character*72 bout, bout2

      call metbout(texte, bout, x)
      call metbout(texte2, bout2, y)
      bout(37:72) = bout2(1:36)
      write (6,*) bout
      return
      end


      subroutine metbout(texte, bout, x)
      character*(*) bout, texte
      
      real x
      bout = ' '
      if (x.gt.1e12) then
        write (bout,200) texte, ' =', x*1e-12,' T' 
      elseif (x.gt.1e9) then 
        write (bout,200) texte, ' =', x*1e-9,' G' 
      elseif (x.gt.1e6) then 
        write (bout,200) texte, ' =', x*1e-6,' Meg'
      elseif (x.gt.1e3) then 
        write (bout,200) texte, ' =', x*1e-3,' K'
      elseif (x.gt.1) then 
        write (bout,200) texte, ' =', x
      elseif (x.gt.1e-3) then 
        write (bout,200) texte, ' =', x*1e3,' m'
      elseif (x.gt.1e-6) then 
        write (bout,200) texte, ' =', x*1e6,' u'
      elseif (x.gt.1e-9) then 
        write (bout,200) texte, ' =', x*1e9,' n'
      elseif (x.gt.1e-12) then 
        write (bout,200) texte, ' =', x*1e12,' p'
      else 
        write (bout,200) texte, ' =', x*1e15,' f'
      endif
200   format (a, a, f8.3, a)
      return
      end


* Lecture d'un reel en style electronicien 
      subroutine readelec(question, x)
      implicit none
      character*(*) question
      character*20 champ, champclean
      real x
      integer indexp, indexn, indexu, indexm, indexk, indexmeg, indexg
      integer indexf, indext

      write (6, 100) question, ' ? '
100   format (1x, a, a, $)
      read (*, '(a)') champ
      indexf = max(index(champ,'F'), index(champ,'f'))
      indexp = max(index(champ,'P'), index(champ,'p'))
      indexn = max(index(champ,'N'), index(champ,'n'))
      indexu = max(index(champ,'U'), index(champ,'u'))
      indexm = max(index(champ,'M'), index(champ,'m'))
      indexk = max(index(champ,'K'), index(champ,'k'))
      indexmeg = max(index(champ,'MEG'), index(champ,'meg'),
     +  index(champ,'Meg'))
      indexg = max(index(champ,'G'), index(champ,'g'))
      indext = max(index(champ,'T'), index(champ,'t'))


      if (indexf.gt.0) then
        champclean = champ(1:indexf-1)
        read (champclean, *) x
        x = 1e-15*x

      elseif (indexp.gt.0) then
        champclean = champ(1:indexp-1)
        read (champclean, *) x
        x = 1e-12*x

      elseif (indexn.gt.0) then
        champclean = champ(1:indexn-1)
        read (champclean, *) x
        x = 1e-9*x

      elseif (indexu.gt.0) then
        champclean = champ(1:indexu-1)
        read (champclean, *) x
        x = 1e-6*x

      elseif ((indexm.gt.0).and.(indexmeg.eq.0)) then
        champclean = champ(1:indexm-1)
        read (champclean, *) x
        x = 1e-3*x

      elseif (indexk.gt.0) then
        champclean = champ(1:indexk-1)
        read (champclean, *) x
        x = 1e3*x

      elseif (indexmeg.gt.0) then
        champclean = champ(1:indexmeg-1)
        read (champclean, *) x
        x = 1e6*x

      elseif (indexg.gt.0) then
        champclean = champ(1:indexg-1)
        read (champclean, *) x
        x = 1e9*x

      elseif (indext.gt.0) then
        champclean = champ(1:indext-1)
        read (champclean, *) x
        x = 1e12*x

      else
        read (champ, *) x
      endif        

      return
      end

* Lecture d'un entier
      subroutine readinteg(question, n)
      implicit none
      character*(*) question
      integer n

      write (6, 100) question, ' ? '
100   format (1x, a, a, $)
      read *, n

      return 
      end

