C++ || string with c++ || Part - 1
Programming codester
[PART-1]
in previous tutorial we learn about operators.
So now it's time to learn the concept of string with object-oriented programming with c++.
Question of the day:
Which memory storage is widely used in PCs and Embedded Systems?
a) EEPROM
b) Flash memory
c) SRAM
d) DRAM
STRING WITH C++: -
- Strings are used for storing text.
- A string variable contains a collection of characters.
- So, let's learn with example about string.
Syntax:
- string variable = “your string”;
EXAMPLE:
- In this example variable is blog and string are programming codester.
- To use strings, you must include an additional header file in the source code, the <string> library.
- Example of string with object-oriented programming with c++.
So, you should try this example to learn string better.
So now out next topic is,
C++ String Concatenation
String Concatenation
Concatenation means adding two or more strings.
The + operator can be used between strings to add them together to make a new string. This is called concatenation:
- We declared two different string variables b1 and b2 and we stored different string in it and sum of that string and stored another variable b3 and printed it.
- Now we want some space between the 2 strings.
- So, its example here:
If we need space, we enter space like that.
So, I hope u understood about string with c++:
In the next tutorial we will be learning other operators in detail.
C tutorials:
So, guys if you want to do a master's in coding, you should practice the program every day.
Thank you for your support!
Learn and explore!
Comments
Post a Comment