-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimlinkedlistimplement.cpp
More file actions
94 lines (84 loc) · 1.88 KB
/
Copy pathtimlinkedlistimplement.cpp
File metadata and controls
94 lines (84 loc) · 1.88 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
#include "timlinkedlist.h"
#include <iostream>
#include <string>
using namespace std;
types_of_monsters* types_of_monsters::build_and_return_list (istream& fin)
{
auto count = 0, index = 0;
char trash, read;
types_of_monsters *firstptr, *temp_ptr;
temp_ptr = new types_of_monsters;
firstptr = temp_ptr;
while (count < 12)
{
fin >> temp_ptr->id_num;
fin.get (trash);
fin.get (trash);
fin.get (read);
for (index = 0; read != '"'; index++)
{
temp_ptr->before += read;
fin.get (read);
}
index++;
temp_ptr->before += '\0';
fin >> temp_ptr->num_of_probs;
fin.get (trash);
fin.get (trash);
fin.get (read);
for (index = 0; read != '"'; index++)
{
temp_ptr->after += read;
fin.get (read);
}
index++;
temp_ptr->after += '\0';
count++;
if (count < 12)
{
temp_ptr->ptr = new types_of_monsters;
temp_ptr = temp_ptr->ptr;
}
else
{
temp_ptr->ptr = nullptr;
}
}
return firstptr;
}
types_of_monsters* types_of_monsters::get_monster (types_of_monsters* monster, int mon_num)
{
auto pass = false;
char trash, read;
types_of_monsters *temp_ptr;
temp_ptr = monster;
while (pass == false)
{
if (temp_ptr->id_num != mon_num)
{
temp_ptr = temp_ptr->ptr;
pass = false;
}
else
{
pass = true;
}
}
return temp_ptr;
}
int types_of_monsters::get_num_of_probs ()
{
return num_of_probs;
}
void types_of_monsters::change_num_of_probs (int num)
{
num_of_probs = num;
}
void types_of_monsters::display_before ()
{
cout << before;
}
void types_of_monsters::display_after ()
{
cout << after;
}