-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.cpp
82 lines (71 loc) · 1.57 KB
/
functions.cpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//function implementation
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
//define structs
struct Animal {
std::string name;
std::string type;
std::string regNo;
int problem;
};
struct Vet {
std::string name;
double quality;
};
struct Problem {
std::string name;
double determinationComplexity;
double treatmentComplexity;
std::string treatment;
};
struct Treatment {
std::string name;
};
int readInputFiles(char* files[])
{
std::cout << "Called function readInputFiles()" << std::endl;
std::ifstream in;
in.open(files[0]);
if(in.bad()) return -1;
if(in.eof()) return -2;
if(in.fail()) return -3;
std::cout << "Successfully opened file" << std::endl;
Animal a;
//std::vector<Animal> animalList;
//char animalStr[50];
std::string name, type, regNo;
int problem;
//std::cout << animalStr << std::endl;
in >> name >> type >> regNo >> problem;
a.name = name;
a.type = type;
a.regNo = regNo;
a.problem = problem;
std::cout << a.name;
//int animalCounter = 0;
/* for(char c : animalStr) {
in >> a.name >> a.type >> a.regNo >> a.problem;
/* a.name += c;
}
while(c != ':') {
a.type += c;
}
while(c != ':')
a.regNo += c;
std::string problem = "";
while( c != '.')
problem += c;
a.problem = stoi(problem);
animalList[animalCounter] = a;
animalCounter++;
}
for(int i=0; i < animalList.size(); i++) {
std::cout << animalList[i].name << std::endl;
std::cout << animalList[i].type << std::endl;
std::cout << animalList[i].regNo << std::endl;
std::cout << animalList[i].problem << std::endl;
}*/
return 0;
}