-
Notifications
You must be signed in to change notification settings - Fork 1
/
wheel.cpp
44 lines (38 loc) · 832 Bytes
/
wheel.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
#include "wheel.h"
Wheel::Wheel(string m, string t, int i):
Accessory(m,t,i,true)
{
}
void Wheel::Initialize()
{
string ty,ma;
ifstream wheelf("wheel.txt");
int linenumber=0;
if(wheelf.is_open()){
while(!wheelf.eof()){
linenumber++;
getline(wheelf,ty);
}
wheelf.close();
wheelf.open("wheel.txt");
int line=RandomNumber(linenumber);
linenumber=0;
string f;
while(!wheelf.eof()){
if(line==linenumber){
wheelf>>ma>>ty;
break;
}
getline(wheelf,f);
linenumber++;
}
}else{
cout<<"FATAL ERROR, wheel.txt file is not openable"<<endl;
}
wheelf.close();
this->setMaker(ma);
this->setType(ty);
}
Wheel::Wheel()
{
}