8viii.cpp
来自「《C/C++程序设计导论(第二版)》一书的程序源文件」· C++ 代码 · 共 14 行
CPP
14 行
// CurrentlyTaking() Test if newdrug is in the file "temp.txt"
// IN: contradrug is a drug the patient should not take.
int CurrentlyTaking (int contradrug)
{ int currently_taking, found = 0;
ifstream fin ("temp.txt", ios::in);
while (fin >> currently_taking && !found)
if (currently_taking == contradrug)
found = 1;
fin.close(); // close so file might be re-opened in a subsequent call
return (found);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?