-
Multi-string chaos
Good Evening:
The following code contains a snippet from what will one day evolve into a rather large project; my next step is to find a way to read a string and find not only one word, but multiple words if necessary. I have tried different combinations of vars, arrays, and such but keep getting typical compiler results.
* I am always caught between flushing out the code myself until I cannot find the answer (everyday):) or coming to these boards for a tad of friendly advice. Multiple String Search, anyone?
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 * pch;
pch=strstr (name, "good"); //Searching for “good” in ^ Char str
if(pch !=NULL)
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
}
For now, back to work coding.
:D
thank-you much,
reRanger