comp.lang.ada
 help / color / mirror / Atom feed
* Re: how to convert float number into char string?
       [not found] ` <31BDD755.53E4@thirdsigma.mv.com>
@ 1996-06-15  0:00   ` Nasser Abbasi
  0 siblings, 0 replies; only message in thread
From: Nasser Abbasi @ 1996-06-15  0:00 UTC (permalink / raw)
  To: Al Cilcius



Since this was shown in C and C++, we might as well show it in Ada 
for completion sake :)


--
-- move float number to string... Ada95 version ... Nasser Abbasi
--

with Ada.Text_Io; use Ada.Text_Io;
with Ada.Strings.Fixed; use Ada.Strings.fixed;

procedure My_Float is
  type Float_Type is digits 10;  --  lets have a 10 digits float number
  Fs: String(1..80);
  F: Float_Type;
begin

  F:=2.57876453;                                -- give it some value

  Put_Line("float is " & Float_Type'Image(F)); -- print it

  -- print how many digits our floating variable has
  Put_Line("f has this many digits=" & Integer'Image(Float_Type'Digits));

  Move(Float_Type'Image(F),Fs);             -- move the float to string

  Put_line(Fs);    -- and print the string to make sure it is there 
end My_Float;
-- 
Nasser Abbasi. C/C++/Ada Solaris. GeneAssist - A client/server 
application for Nucleic acid and protein sequence search and analysis.
PE-Applied BioSystem division. email:  nasser@apldbio.com   
MSEE, MSCS, MSCE, FM (and Karpov is my chess hero! ..).




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-06-15  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4pic7t$73s@hobbes.cc.uga.edu>
     [not found] ` <31BDD755.53E4@thirdsigma.mv.com>
1996-06-15  0:00   ` how to convert float number into char string? Nasser Abbasi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox