Re: How to display a number?

From: James Jackson <james.jackson_at_cern.ch>
Date: Mon, 5 Apr 2010 11:58:04 +0200


Surly std::cout << myNumber; will do the trick?

Or you could use a stringstream, I've used that in CINT before.

Regards,
James.

On 5 Apr 2010, at 11:56, Cedric Sodhi wrote:

> Simple task, one would assume. C++ offers quite a bunch of facilities to
> display a number as a string, such as
>
> boost::lexical_cast< string >
> printf
> sprintf
> snprintf
>
> Unfortunally, CINT doesn't recognize any of them (I didn't even try to
> use boost because that's kind of out of the question in the first
> place). I don't understand why among the printf functions from <cstdio>
> only printf is recognized...
>
> Anyway, how do you tackle this apparently impossible task which should
> actually be pretty common?
>
Received on Mon Apr 05 2010 - 11:58:09 CEST

This archive was generated by hypermail 2.2.0 : Mon Apr 05 2010 - 17:50:01 CEST