this is wat i got so far.... please chek ur hotmail.. #include <iostream> #include <cstring> int main() { int x = 0,y=0,total; char ans[100]; char *al[100]; char pattern[100]; char *match[100]; while (true) { cout << "Input string (enter X to stop): "; cin.getline(ans,100); if (ans[0] == 'X' && ans[1] == '\0') break; al[x] = new char[(strlen(ans)+1)]; strcpy( al[x], ans ); x++; } total = x; cout << "Search Pattern: "; cin >> pattern; for (x=0;x<total;x++) { if (strstr(al[x],pattern)) { match[y] = al[x]; y++; } } total = y; cout << "Number of matches: " << total << endl; for(x=0;x<total;x++) { cout << match[x] << endl; } return 0; }