Can anyone explain this error? I am trying a return of 2 substrings from one primary string; I thought this was the way to do it. ? ?
Code:#include <stdio.h> #include <fstream> #include <iostream> #include <string.h> #include <windows.h> using namespace std; int main() { char resp1[]="good"; char name[256]; cout<< "Hello, how are you today?\n"<< endl; cin.getline (name,256); char a * pch; pch=strstr (name, "good"); //Searching for “good” in ^ Char str if(pch !=NULL) //-INSERT // removed ! mark char b * pch;//-INSERT pch=strstr (name, "not");//-INSERT if(pch !=NULL) //-INSERT // removed ! mark cout<< "I am glad to hear you are doing well today."<< endl; else cout<< "Is anything wrong at all? Would you like to discuss it? \n"<< endl; Sleep(50000); return 0; //END }