#include<cstdlib>
#include <iostream>
using namespace std;
void stringMatch( char * Teks, int pTeks, char * Pola, int pPola )
{
int i, j;
i=0;
while( i <= ( pTeks - pPola ))
{
j=0;
while(j < pPola)
{
if ( Teks[i + j] == Pola[j] ){
j++;
}
else
break;
}
if ( j == pPola )
cout<<" PATTERN "<<Pola<<" WAS FOUND at index : "<<i+1<<endl;
i++;
}
}
int main( )
{
stringMatch( "informatics engineering", 23, "tic", 3 );
system("PAUSE");
return EXIT_SUCCESS;
}
0 komentar:
Post a Comment