0% found this document useful (0 votes)
5 views1 page

Prefixe

The document contains a C++ program that manipulates strings using prefixes and suffixes. It includes functions to read a string, print it with varying indentations, and modify the string by removing characters or reversing it. The program demonstrates various string operations such as copying, concatenating, and modifying string lengths.

Uploaded by

DIANA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Prefixe

The document contains a C++ program that manipulates strings using prefixes and suffixes. It includes functions to read a string, print it with varying indentations, and modify the string by removing characters or reversing it. The program demonstrates various string operations such as copying, concatenating, and modifying string lengths.

Uploaded by

DIANA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

PREFIXE si SUFIXE

s a t e l i t cin>>s;
a t e l i t int l=strlen(s);
t e l i t for(int i=0; i<l; i++)
e l i t { for(int j=0;j<i;j++)
l i t cout<<" ";
i t cout<<s<<endl;
t strcpy(s,s+1); }
t cin>>s;
i t int l=strlen(s);
l i t for(int i=0; i<l; i++)
e l i t { for(int j=0;j<l-i-1;j++)
t e l i t cout<<" ";
a t e l i t cout<<s+l-i-1<<endl;
s a t e l i t }

s
cin>>s;
s a
int l=strlen(s);
s a t for(int i=0; i<l; i++)
s a t e { for(int j=0;j<l-i-1;j++)
s a t e l cout<<" ";
s a t e l i strcpy(p,s);
p[i+1]='\0';
s a t e l i t
cout<<p<<endl;

s a t e l i t cin>>s; else
t i l e t a int l=strlen(s); { strcpy(p,t);
s a t e l for(int i=0; i<l; i++) strcpy(p,p+1);
l e t a { if(i%2==0) strrev(p);
s a t { strcpy(t,s); cout<<p<<endl;} }
t a t[l-i]='\0';
s cout<<t<<endl;
}

s cin>>s;
s a int l=strlen(s);
s a t for(int i=0; i<l; i++)
s a t e { strcpy(p,s);
s a t e l p[i+1]='\0';
s a t e l i cout<<p<<endl;
s a t e l i t }

s a t e l i t cin>>s;
s a t e l i int l=strlen(s);
s a t e l for(int i=0; i<l; i++)
s a t e { for(int j=0;j<i;j++)
s a t cout<<" ";
s a cout<<s<<endl;
s s[strlen(s)-1]='\0';
}

You might also like