Advertisement
arsovski

StringCompare

May 21st, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement