Hello:
How can I search one input string for two substrings?
This does not work:
Code:
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string.h>
#include <windows.h>
using namespace std;
int main()
{
char resp1[]="good,no";
char name[256];
char resp[]="not";//-Check*
char name1[256];//-Check*
cout<< "Hello, how are you today?\n"<< endl;
cin.getline (name,256);
char * pch;
pch=strstr (name, "good"); //Searching for “good” in ^ Char str
if(pch !=NULL)
char * pch;//-Check*
pch=strstr (name1, "not"); //Searching for “good” in ^ Char str//-Check*
if(pch !=NULL)
{
cout<< "I am glad to hear you are doing well today.\n"<< endl;
else
cout<< "Is anything wrong at all? Would you like to discuss it? \n"<< endl;
}
Sleep(50000);
return 0; //END
}