Learn More

Monday, August 15, 2011

Namespace And Basic Strings

c++ logo
Like other programming languages​​, C + + also provides a data string. A data is not derived from the numerical, and such data must contain more than one character. The use of string is needed by a program, it is not uncommon to use a function from a string. So the introduction of the string at the beginning to learn c + + is required.



Introduction to Strings
In practice, if you want to use a string in c + +, then we have to put libraries of <string> on the header. And usually include namespace std thereafter. String in C + + has its own advantages when compared with the c language in general. When the c language, each character in the string is stored in a computer memory array, then using c + + can all be stored in one class. Inside, there are built-ins that work with strings. Another advantage of the string in c + + we can provide the initial state as well as numerically. Please read our post about data and variables to see how to get initialize.



Please try this code in codeblocks and give it name project as learncpp2.



Namespace
Part one is quite interesting, because using this we can do a grouping of classes, functions, certain objects in just a name. Namespace must be given a specific name and then referred to as an identifier. When interpreted in a simple identifier is a name that serves to distinguish it from other namespace types. You can give your own name on the identifier. In the namespace contained a set of objects, classes, and certain functions. Then we named it as an entity. In practice if we want to use that entity, then we must include the sign operator scop:: after the identifier.


Please try in codeblocks and give it name project as learncpp3.



External links:

Post a Comment