Advertisement
Guest User

Tareq

a guest
Oct 7th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. void myComphere(string source,string des)
  6. {
  7.     int len1,len2;
  8.     len1 = source.size();
  9.     len2 = des.size();
  10.     if(source.compare(des)==0)
  11.     {
  12.         cout << "These two string are equal" <<endl;
  13.     }
  14.     else
  15.     {
  16.         if(len2> len1)
  17.             len1=len2;
  18.         int i;
  19.         for(i=0; i<len1; i++)
  20.         {
  21.             if(source[i]!=des[i])
  22.             {
  23.                 cout << "These two string are not equal at position no " << i << endl;
  24.                 return;
  25.             }
  26.         }
  27.  
  28.     }
  29.  
  30. }
  31. void myInput()
  32. {
  33.     string s1,s2;
  34.     cin >> s1 >> s2;
  35.     myComphere(s1,s2);
  36. }
  37.  
  38. int main()
  39. {
  40.     myInput();
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement