- Program :
#include <iostream>
#include <string>
using namespace std;
int main() {
cout <<"\n----------------STRING OPERATIONS----------------\n";
string a = "C++ ";
string b = "Programming";
string c = a.append(b);
string d = "Class";
string e = "Cow";
e[0] = 'W';
string name;
cout <<"\nString Concatenation is "<<c;
cout <<"\nThe length of the string is " << b.length();
cout <<"\nThe accessed characters in a string is " << d[0];
cout <<"\nThe changed string character is " << e;
cout <<"\n----------------USER INPUT STRINGS----------------\n";
cout <<"\nEnter your full name: ";
cin >> name;
cout <<"\nYour name is : " << name;
return 0;
}
- Output :
No comments:
Post a Comment