Thursday, July 29, 2010

C++: Misc notes 4

Few misc notes about member functions:
* You need to first include the desired library before you can even declare
that variable type and use its functions.
* There is a handy function to combine two or more strings, ironically it is
the plus (+) sign. For instance, if I want to have three string variables
named A, b, and C, assign some text string on A and B and combine these
strings into C, I would write:
string A, B, C; // Which is legal.
A = "Hello, "; B = "World!";
C = A + B;
cout << C << endl;
If we run this code, it'll print out "Hello, World!" to the screen.

I think that's it for now... If you have any comments, please let me know.
// JL

No comments:

Post a Comment