Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- void myComphere(string source,string des)
- {
- int len1,len2;
- len1 = source.size();
- len2 = des.size();
- if(source.compare(des)==0)
- {
- cout << "These two string are equal" <<endl;
- }
- else
- {
- if(len2> len1)
- len1=len2;
- int i;
- for(i=0; i<len1; i++)
- {
- if(source[i]!=des[i])
- {
- cout << "These two string are not equal at position no " << i << endl;
- return;
- }
- }
- }
- }
- void myInput()
- {
- string s1,s2;
- cin >> s1 >> s2;
- myComphere(s1,s2);
- }
- int main()
- {
- myInput();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement