SHARE
TWEET

StringCompare

arsovski May 21st, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include<string.h>
  3. using namespace std;
  4. void compareString ( char* str,char * str2);
  5.  
  6. int main()
  7. {
  8.     char dar2[]="";
  9.     char dass[]="";
  10.     compareString(dar2,dass);
  11.  
  12.     return 0;
  13. }
  14.  
  15. void compareString(char* str,char* str2){
  16.     for(int i=0;i<strlen(str);i++){
  17.    BEGIN:       int defaultIndex=0;
  18.         if(str[i]==str2[defaultIndex]){
  19.             defaultIndex++;
  20.              for(int  j=i+1;j<strlen(str);j++,defaultIndex++){
  21.                  if(str[j] == str2[defaultIndex])
  22.                     continue;
  23.                 else goto BEGIN;
  24.              }
  25.              std::cout<<"strings match"<<std::endl;
  26.             }
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top