New to c++. I'm trying to figure out how to use strcmp with array's . I need to see if a array holds the word "hello". I can't get my code to work quite right. What is it missing?
#include<iostream>
#include<cctype>
#include<cstring>
using namespace std;
int main()
{ char a[30];
char b[10];
char word1[30];
char word2[10];
cout<< " enter in a phrase"<< endl;
cin>> a;
cout << "enter word you want to search for"<< endl;
cin >> b;
strcpy(word1,a);
strcpy(word2,b);
if (strcmp(word1,word2))
cout<< "I found your word:"<< endl;
else
cout << " that word was not found:"<<endl;
return 0;
}