Ive done most of this problem, and I have my file outputted but im stuck on what to do next.
The program problem is that a veterinarian needs a program to manage his processing of his patients. When a person arrives with their pet, the pet information is input into a Pet structure. Next, the pet record is entered into his queue of patients at the proper location. The pet information consists of the owner’s name (20 characters), the pet’s name (20 characters), and an integer emergency code (0 = normal, 1 = emergency).
When the vet finishes with a patient, that animal is removed from the queue. The vet then takes the next patient in the queue. We will not consider emergencies. It will always be FIFO.
To simulate the day’s operations, a transaction file is used. Each record in the file consists of four fields:
action code (1 character) A (add this patient) or H (handle next patient)
owner’s name
pet’s name
If the action code is H, then the other two fields are not present. If the action code is A, then the other two fields are present.
sample output:
Added: Samuel Spade Fido
Added: John Jones Rover
Added: Betsy Ann Smithville Jenny
Treated: Samuel Spade Fido
Treated: John Jones Rover
Added: Lou Ann deVille Kitty
Treated: Lou Ann deVille Kitty
Added: Tom Smythe Fifi
Added: Marie Longfellow Jack
Treated: Marie Longfellow Jack
Treated: Betsy Ann Smithville Jenny
Treated: Tom Smythe Fifi
my code so far, its a work in progress right now
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#include <iostream>
#include <list>
#include <string>
#include <vector>
#include <fstream>
#include <cctype>
using namespace std;
//
class class_xmpl
{
string petName ;
string ownerName;
int emergencyCode ;
public:
class_xmpl(string name_in = "James Bond", int id_in = 007)
{
petName = name_in;
ownerName = name_in;
emergencyCode = id_in;
}
void set_name(string name_in)
{
petName = name_in;
ownerName = name_in;
}
string get_name()
{
return petName;
return ownerName;
}
};
//
int main()
{
string line;
ifstream inFile ("patient.txt");
if (inFile.is_open())
{
while (getline (inFile, line))
{
cout << line << endl;
}
inFile.close();
}
else cout << "Unable to open file.";
vector <class_xmpl> vector_xmpl;
class_xmpl scrt_agent;
list <class_xmpl> L;
vector_xmpl.push_back(scrt_agent);
system("pause");
return 0;
}
|