You are on page 1of 3

STRING MANIPULATION

#include<iostream.h>

#include<conio.h>

#include<string.h>

class string

private:

char str1[20],str2[20],str3[20];

int length;

public:

void copy()

cout<<"\n Enter the string1:";

cin>>str1;

strcpy(str2,str1);

cout<<"\n The copied string="<<str2;

void concatenate()

cout<<"\n Enter the string1:";

cin>>str1;

cout<<"\n Enter the string2:";


cin>>str2;

strcat(str2,str1);

cout<<"\n Concatenated string="<<str2;

void len()

cout<<"\n Enter the string1:";

cin>>str1;

length=strlen(str1);

cout<<"\n Length of the string="<<length;

void rotate()

int i,j,k;

cout<<"\n Enter string1:";

cin>>str1;

length=strlen(str1);

for(i=length;str1[i]!='\0';i--)

for(j=i;str1[j]!='\0';j--)

cout<<str1[j];

}
for(k=length;k>=0;k--)

cout<<str1[k];

cout<<"\n";

};

void main()

string s;

s.rotate();

getch();

You might also like