Search This Blog

Friday, 21 August 2020

Combo of all program

 #include<iostream>

using namespace std;

int main()

{

string str1,str3;

string str2="hello";

cout<<"enter the first string"<<endl;

cin>>str1;

cout<<"enter the second string:"<<endl;

cin>>str2;

if(str1.empty())

{

cout<<"string 1 is empty"<<endl;

}

else

{

cout <<"string is not empty"<<endl;

}

if(str2.empty())

{

cout<<"string 2 is empty."<<endl;

}

else

{

cout<<"strig 2 is not empty."<<endl;

}

string str="good morning";

char findout;

cout<<"string is:"<<str<<endl;

cout<<"enter the charactor you want to find:"<<endl;

cin>>findout;

cout<<"we find the "<<findout<< " "<<"at :"<<str.find(findout);

     str=" I YOU ";


int a;


cout << "\nString is:"<<str<<endl;

str.insert(2," HATE ");

cout<<"\n\nString after the insert():"<<str<<endl;

str.replace(2,5," LOVE ");

cout<<"\n\nString after the replace ():"<<str;


cout<<"\nEnter the new string:"<<endl;

cin>>str1;

cout<<"\n What you want want to insert():"<<endl;

cin>>str2;

cout<<"On Which postion:";

cin>>a;

str.insert(a,str2);

cout<<"After the insertion:"<<str1;

str="helpdesk";


cout<<"string is :"<<str;

cout<<"length of the string is :"<<str.length();

cout<<"\n enter the string:"<<endl;

cin>>str1;

cout<<"\n enter the 2nd srinfg :"<<endl;

cin>>str2;

cout<<"\nlength of "<<str1<<" is:"<<str1.length();

cout<<"\n length of "<<str2<<" is :"<<str2.length();

cout<<"Enter the first string:";

getline(cin,str1);

cout<<"Enter the second string:";

getline(cin,str2);

if(str1==str2)

{

cout<<"strring are equal.";

}

else

{

cout<<"string are not equal.";

}

cout<<"Enter the first string:";

getline(cin,str1);

cout<<"Enter the second string:";

getline(cin,str2);

str3=str1+str2;

cout<<"new string is:"<<str3;

int b,c;

cout<<"enter the first integer :";

cin>>a;

cout<<"enter the second integer:";

cin>>b;

c=a-(-b);

cout<<"addo]ition is:"<<c;

if(cout<<"hello wlcome to c++ programming:")

{

}

str="good mornining";

cout<<"string is:"<<str<<endl;

str.erase(6);

cout<<"string after the earrase():  "<<str<<endl;

return 0;

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts