-
Notifications
You must be signed in to change notification settings - Fork 0
/
rand.h
39 lines (31 loc) · 804 Bytes
/
rand.h
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
#ifndef RAND
#define RAND
#include <string>
#include <stdlib.h>
using namespace std;
class Rand : public Base
{
private:
Op* value;
public:
Rand()
{
value = new Op(rand() % 100);
}
double evaluate()
{
return value->evaluate();
}
string stringify()
{
string result = to_string(value->evaluate());
return result;
}
virtual Base* get_left(){};
virtual Base* get_right(){};
void accept(CountVisitor* v){
return v->visit_rand();
}
Iterator* create_iterator(){return new NullIterator(this);};
};
#endif