T7U5_Declaring_and_Intialization_String
T7U5_Declaring_and_Intialization_String
· The string object declaration and intialization can be done once by using a constructor of the
string class.
Constructor Meaning
string(const string & text) produces a string object from another string obj
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
clrscr();
string text;
string text("C++");
string text2("OOP");
cout<<"\n text1:"<<text1;
cout<<"\n text2:"<<text2;
text=text1;
cout<<"\n text:"<<text;
getch();
OUTPUT
text1: C++
text2: OOP
text : C++