📄 8v.cpp
字号:
// drugtest.cpp Compare new prescription with currently
// prescribed meds for illegal and dangerous combinations.
// ASSUMPTION: the files "patients.txt" and "drugs.txt" exist.
#include <iostream.h>
#include <fstream.h>
const int END = -1;
void main ()
{ int patID, newdrug, contradrug;
ifstream patfile ("patients.txt", ios::in); // patient records
ifstream drugfile ("drugs.txt", ios::in); // drug records
ofstream outfile ("temp.txt", ios::out); // list of current meds
cout << "enter patient ID and drug number: ";
cin >> patID >> newdrug;
// Make a list of the current medications for this patient in file "temp.txt"
MakeList (patID, patfile, outfile);
outfile.close();
// Find the new drug in the "drugs.txt" database file
FindDrug (drugfile, newdrug);
// Search the contra-indicated drugs for each drug the patient is taking ("temp.txt')
if (drugfile)
if (drugfile >> contradrug)
while (contradrug > 0)
{ if (CurrentlyTaking (contradrug))
cout << "*WARNING; drug interaction possible!"<< endl;
drugfile >> contradrug;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -