Article View: be.comp.programming
Article #518Re: Converteren C++
From: Kristoffel
Date: Sun, 13 May 2007 02:05
Date: Sun, 13 May 2007 02:05
29 lines
1720 bytes
1720 bytes
Manchiu wrote:
> Hallo,
>
> hoe kan ik in C++ variabelen converteren naar een string?
>
>
vb:
#include <iostream>
#include <sstream> // String Streams
using namespace std;
int main (void) {
int i = 123;
float f = 3.14;
ostringstream oss;
oss << "Dit is een integer > " << i << " <,";
oss << " en dit is een float > " << f << " <";
cout << oss.str() << endl;
return 0;
}
geeft als output:
Dit is een integer > 123 <, en dit is een float > 3.14 <
--
Kristoffel
Technical Details
Message-ID:
<tnu1i.173280$9P1.1147006@phobos.telenet-ops.be>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!feed.xsnews.nl!border-1.ams.xsnews.nl!68.142.88.75.MISMATCH!hwmnpeer01.ams!news.highwinds-media.com!kramikske.telenet-ops.be!nntp.telenet.be!kwabbernoot.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mailReferences:
<Xhm1i.172573$pj4.1197158@phobos.telenet-ops.be>Show Full Headers
Complete Article Headers
X-Google-Thread: fcea4,51170fa134f521e6 X-Google-Attributes: gidfcea4,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!feed.xsnews.nl!border-1.ams.xsnews.nl!68.142.88.75.MISMATCH!hwmnpeer01.ams!news.highwinds-media.com!kramikske.telenet-ops.be!nntp.telenet.be!kwabbernoot.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail From: Kristoffel <noname_nomail.nospam@yahoo.com> User-Agent: Thunderbird 1.5.0.10 (X11/20070301) MIME-Version: 1.0 Newsgroups: be.comp.programming Subject: Re: Converteren C++ References: <Xhm1i.172573$pj4.1197158@phobos.telenet-ops.be> In-Reply-To: <Xhm1i.172573$pj4.1197158@phobos.telenet-ops.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lines: 29 Message-ID: <tnu1i.173280$9P1.1147006@phobos.telenet-ops.be> Date: Sun, 13 May 2007 02:05:13 GMT NNTP-Posting-Host: 213.118.158.48 X-Complaints-To: abuse@telenet.be X-Trace: phobos.telenet-ops.be 1179021913 213.118.158.48 (Sun, 13 May 2007 04:05:13 MEST) NNTP-Posting-Date: Sun, 13 May 2007 04:05:13 MEST Organization: Telenet Internet