| | |
remark if word not found in text
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2007
Posts: 12
Reputation:
Solved Threads: 0
I wrote a program that searched a file word by word, looking for keywords from another file that needed to be replaced in the first file. I did this, but I need to state an error message if one of the keyword was never found.
This is what i tried,
for (int i = 0; i < count; i++){
if (potter.eof() && (text != word[i])){
cout << endl << endl;
cout << word[i] << endl;
}
}
where potter is the file is was searching, word[i] is an array of the keywords, and text is the word from the potter file I am checking. I realize why this doesn't work, its outputting for each individual word if the keyword was not found instead of the whole text. But I am having problems fixing this.
Sorry if this was confusing, and thanks for any help.
This is what i tried,
for (int i = 0; i < count; i++){
if (potter.eof() && (text != word[i])){
cout << endl << endl;
cout << word[i] << endl;
}
}
where potter is the file is was searching, word[i] is an array of the keywords, and text is the word from the potter file I am checking. I realize why this doesn't work, its outputting for each individual word if the keyword was not found instead of the whole text. But I am having problems fixing this.
Sorry if this was confusing, and thanks for any help.
![]() |
Similar Threads
- search in text file (C++)
- Which is more affective: Banner Ads or Text Links? (Promotion and Marketing Plans)
- An invalid character was found in text content. Error processing resource (Web Browsers)
- get the coordenates of a word in a puzzle (C)
- Word in Text (Python)
- text processing? (Java)
- I can't implement a word count into my text editor (JAVA) (Java)
Other Threads in the C++ Forum
- Previous Thread: Difficulty in utilizing functions; C2440 Error
- Next Thread: CDialog in userless mode?
| Thread Tools | Search this Thread |
api application array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux loop looping loops map math matrix memory multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





