In: Computer Science
UPDATE: Whole Code
How do I fix this Bold part "!= Null" ? its showing me Error? please Help
#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<stdlib.h>
#include<sstream>
using namespace std;
int main(){
string list[1000];
cout << "! Opening data file... ./Data.CS.SFSU.txt\n";
ifstream fin("Data.CS.SFSU.txt");
if(fin.fail()){
cout << "Error opening file\n";
return 0;
}
cout << "! Loading data...\n";
int count = 0;
while(getline(fin,list[count])!=NULL){
//cout << "--------------------\n";
count++;
}
cout << "! Loading completed...\n";
fin.close();
cout << "! Closing data file... ./Data.CS.SFSU1.txt\n";
cout << "-----DICTIONARY 340 C++-----\n";
while(true){
cout << "Search:";
string line;
getline(cin,line);
cout << "|" << endl;
stringstream ss(line);
string word1, word2, word3;
ss >> word1 >> word2;
if (ss >> word3 || (word2 != "noun" && word2 !=
"adjective" && word2 != "verb")){
cout << "Please enter a search key (and a part of
speech)\n";
}
else {
for (int i = 0; i<word1.length(); i++){
word1[i] = tolower(word1[i]);
}
int found = 0;
cout << count << endl;
for (int i = 0; i< count; i++){
char line2[200];
strcpy(line2, list[i].c_str());
char *ch = strtok(line2,"|");
//cout << ch << endl;
while (ch != NULL){
//cout << ch << endl;
//cout << ch1 << " " << endl;
if (strcmp(ch,(char *)word1.c_str()) == 0){
ch = strtok(NULL,"|");
char line[100];
strcpy(line, ch);
char *ch1 = strtok(line," ");
//cout << line << endl;
if (strcmp(ch1,word2.c_str()) == 0){
ch1 = strtok(NULL," ");
ch1 = strtok(NULL," ");
string s ="";
while (ch1 != NULL){
s = s + ch1 + " ";
ch1 = strtok(NULL," ");
}
cout << word1 << "[" << word2 << "] :"
<< s << endl;
found = 1;
break;
}
}
ch = strtok(NULL,"|");
}
if (found == 1)
break;
}
if (found == 0)
cout << "Not found\n";
}
cout << "|" << endl;
}
return 0;
}
PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE

#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<stdlib.h>
#include<sstream>
using namespace std;
int main(){
string list[1000];
cout << "! Opening data file... ./Data.CS.SFSU.txt\n";
ifstream fin("Data.CS.SFSU.txt");
if(fin.fail()){
cout << "Error opening file\n";
return 0;
}
cout << "! Loading data...\n";
int count = 0;
while(getline(fin,list[count])){
//cout << "--------------------\n";
count++;
}
cout << "! Loading completed...\n";
fin.close();
cout << "! Closing data file... ./Data.CS.SFSU1.txt\n";
cout << "-----DICTIONARY 340 C++-----\n";
while(true){
cout << "Search:";
string line;
getline(cin,line);
cout << "|" << endl;
stringstream ss(line);
string word1, word2, word3;
ss >> word1 >> word2;
if (ss >> word3 || (word2 != "noun" && word2 !=
"adjective" && word2 != "verb")){
cout << "Please enter a search key (and a part of
speech)\n";
}
else {
for (int i = 0; i<word1.length(); i++){
word1[i] = tolower(word1[i]);
}
int found = 0;
cout << count << endl;
for (int i = 0; i< count; i++){
char line2[200];
strcpy(line2, list[i].c_str());
char *ch = strtok(line2,"|");
//cout << ch << endl;
while (ch != NULL){
//cout << ch << endl;
//cout << ch1 << " " << endl;
if (strcmp(ch,(char *)word1.c_str()) == 0){
ch = strtok(NULL,"|");
char line[100];
strcpy(line, ch);
char *ch1 = strtok(line," ");
//cout << line << endl;
if (strcmp(ch1,word2.c_str()) == 0){
ch1 = strtok(NULL," ");
ch1 = strtok(NULL," ");
string s ="";
while (ch1 != NULL){
s = s + ch1 + " ";
ch1 = strtok(NULL," ");
}
cout << word1 << "[" << word2 << "] :"
<< s << endl;
found = 1;
break;
}
}
ch = strtok(NULL,"|");
}
if (found == 1)
break;
}
if (found == 0)
cout << "Not found\n";
}
cout << "|" << endl;
}
return 0;
}