• string:-


             C++ has in its definition a way to represent sequence of characters as an object of class. This class is called std:: stringString class stores the characters as a sequence of bytes with a functionality of allowing access to single byte character.


  • operations in string:-




Sr.NoFunction & Purpose
1
strcpy(s1, s2);
Copies string s2 into string s1.
2
strcat(s1, s2);
Concatenates string s2 onto the end of string s1.
3
strlen(s1);
Returns the length of string s1.
4
strcmp(s1, s2);
Returns 0 if s1 and s2 are the same; less than 0 if s1<s2; greater than 0 if s1>s2.
5
strchr(s1, ch);
Returns a pointer to the first occurrence of character ch in string s1.
6
strstr(s1, s2);
Returns a pointer to the first occurrence of string s2 in string s1.
note:- string.h is required header file for above operations.


  • example code:-
#include<iostream.h>
void main()
{
char k[20];
cout<<"Enter a string";
cin>>k;
cout<<''The string entred string is"<<k;
}


note:-it's just a sudo code if its not executing on your device make some changes in the further code this is only for understanding logic.

thankyou for visiting us stay tuned for learning and more intresting u can ask questions in comment section check other blogs for more info. comment mail for compitative cading thankyou.👍😎🙏