Re: No Subject

From: Christian Holm Christensen <cholm_at_nbi.dk>
Date: Thu, 08 Sep 2005 11:52:48 +0200


Hi,

On Thu, 2005-09-08 at 05:00 +0000, chameli ghosh wrote:
>
> Dear Sir/Madam,
> I am chameli Ghosh , Student of MCA(Final Year). My
> Project is continue at VECC ,this is temperature monitoring system by
> using Root & C++ . I have two problem :
> 1. How to display the floating number on the graphical window,
> which is taken from any file ?

Put it in a canvas, for example in a TPave, or TLatex.

	void display_float(x) 
	{ 
		TCanvas* c = new TCanvas("c");
		TLatex*  l = new TLatex(.5,.5, Form("%f", x));
		l->Draw();
	}
	


> 2. How to Conver the string to float & float to string in
> root?(That is not accept the c++ function).

Use std::stringstream's

	std::string 
	float_to_string(const float x) 
        {
	  std::stringstream s;
	  s << x; 
	  return s.str();
        }

	float
	string_to_float(const std::string& s) 
	{ 
	  std::stringstream buf(s);
	  float x; 
	  buf >> x;
	  return x;
        }

Hope that helps.

Yours,

-- 
 ___  |  Christian Holm Christensen 
  |_| |  -------------------------------------------------------------
    | |  Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|           DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|            Denmark                    Office: (+45) 353  25 404
 ____|   Email:   cholm_at_nbi.dk               Web:    www.nbi.dk/~cholm
 | |
Received on Thu Sep 08 2005 - 11:54:36 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET