🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: be.comp.programming
3 messages
3 total messages Started by Manchiu Sat, 12 May 2007 16:53
Converteren C++
#517
Author: Manchiu
Date: Sat, 12 May 2007 16:53
3 lines
1043 bytes
Hallo,

hoe kan ik in C++ variabelen converteren naar een string? 
Re: Converteren C++
#518
Author: Kristoffel
Date: Sun, 13 May 2007 02:05
29 lines
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
Re: Converteren C++
#519
Author: Manchiu
Date: Sun, 13 May 2007 12:15
33 lines
1902 bytes
Gr8,

thx

"Kristoffel" <noname_nomail.nospam@yahoo.com> schreef in bericht 
news:tnu1i.173280$9P1.1147006@phobos.telenet-ops.be...
> 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 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads