📄 9vi.cpp
字号:
// InDictionary() Accept an istream file var. for a disk file// and a string var. for a word. Return true if the word is// found in the dictionary disk file (else false).// ASSUMPTION: file has already been opened// IN: infile is file variable to an alphabetized lower-case dictionary// IN: user_word is a lower-case word.int InDictionary (ifstream& infile, string user_word){ int done = 0; // loop completion flag int found = 0; // word-found flag string dict_word; // var for dictionary words while (!done) { if (infile >> dict_word) // get next dict. word... { if (user_word == dict_word) // do words match? { done = 1; found = 1; } else if (user_word < dict_word) done = 1; // searched too far. } else done = 1; // end of file. } return (found); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -