Computing.Net > Forums > Programming > C++ Concatenation

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ Concatenation

Reply to Message Icon

Name: C++ Newbie
Date: December 3, 2001 at 07:44:59 Pacific
Comment:

i'm trying to concatenate two strings together, but can't get them to work, Can anyone help me please!??!?!! I concatenation of text objects work, but the string concatenation won't compile. Here is a chunk of the code...

cout << "\nUse of concatenation += of a text object\n";
text surname("Jones");
text fullname("Pat");
fullname += surname;
fullname.show();

cout << "\nUse of concatenation of a string object\n";
text fullname2("Pat");
fullname2 += ("Jones");
fullname2.show();

Thanks for any help anyone can give me!



Sponsored Link
Ads by Google

Response Number 1
Name: GigaHertz
Date: December 3, 2001 at 13:36:34 Pacific
Reply:

what is text?
why you don't use STL?
with string you can do that.
ex:
#include
using namespace std;

void main(void){
string surname="Jones";
string fullname="Pat";
fullname +=surname;

cout << fullname;
}

GigaHertz


0

Response Number 2
Name: me
Date: December 6, 2001 at 14:29:30 Pacific
Reply:

howcome you did void main

whats the difference if i were to say int main
and then just return 0;
?
thanx


0

Response Number 3
Name: GigaHertz
Date: December 10, 2001 at 14:24:37 Pacific
Reply:

if you use int main() you have to return a int, but you don't need that because your program is not called by an other one. is like a function, if you don't need a return variable you put void.

GigaHertz

sorry for my english.


0

Response Number 4
Name: v0lumity
Date: January 14, 2002 at 18:31:02 Pacific
Reply:

Void saves memory as nothing will be returned and placed into memory. If you return 0, this 0 needs to be placed in memory. Simple.


0

Response Number 5
Name: madhu
Date: March 11, 2002 at 03:09:43 Pacific
Reply:

Hi,
How do i declare a function that returns a charecter array in a c++ class.
Also can a charecter be appended to a string?
Thanx


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

crystal reports 3-Button mouse behavior o...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ Concatenation

Win32 Applications C++ www.computing.net/answers/programming/win32-applications-c/11484.html

strcat, ExitWindowsEx problems C++ www.computing.net/answers/programming/strcat-exitwindowsex-problems-c/11520.html

Change value in char array in C www.computing.net/answers/programming/change-value-in-char-array-in-c/10213.html