Ok please have a close inspection on my code below, its just a part of a function
void RepeatWord(){
    system("cls");
    string word = NULL;
    string newword = NULL;
    int repeats = 0;
    while(true){
        if(word == NULL){
            cout<<"Currently no word is stored..";
            cout<<"\n\nPlease enter a word: ";
            cin>>word;
        }
....
well I been working with other programming languages and I am always doing a comparison with a NULL value but in C++... it seems to be a different situation. The error says..
error: no match for 'operator==' in 'word == 0'
well I was wondering I am just comparing to a NULL and I really don't know why this is wrong. Is comparing a value to a NULL to C++ is different? please teach me. Thanks
Note: I know more ruby than java
You are trying to compare a object with NULL, You cannot compare objects with a NULL. You need to compare a pointer. In doing so you check if the pointer is pointing to something that is not a valid object.     
In your case you want to check if std::string is empty. You can use member functions provided by std::string, std::string::empty().
Considering Your questions, I am stressing the need for a good learning book:
The Definitive C++ Book Guide and List
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With