-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiagnoses.cpp
66 lines (58 loc) · 1.53 KB
/
Diagnoses.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
#include "Diagnoses.h"
#include <cstdlib>
int randomNumberGenerator(int min,int max){
if(rand()%10==0){
srand(rand()*rand());
}
else{
srand(rand()*rand()*rand());
}
int range = max-min ;
int randomNumber=rand() % range + min ;
return randomNumber;
}
char randomCharGenerator(int min,int max){
int randomInt=randomNumberGenerator(min,max);
return (char)randomInt;
}
std::string randomStringGenerator(int min,int max,int stringLength,bool withSpace){
std::string output;
for(int i=0;i<stringLength;i++)
{
if(withSpace&&randomNumberGenerator(0,99)==1)
{
output+=32;
continue;
}
if(i==4||i==8||i==12||i==16||i==20)
{
output+=randomCharGenerator(65,67);
}
output+=randomCharGenerator(min,max);
}
return output;
}
Diagnoses::Diagnoses(){
id="";
disease_name="";
}
Diagnoses::Diagnoses(string i,string n){
id=i;
disease_name=n;
}
//getters
string Diagnoses::getId(){return id;}
string Diagnoses::getDisease_name(){return disease_name;}
//setters
void Diagnoses::setId(string i){id=i;}
void Diagnoses::setDisease_name(string n){disease_name=n;}
void Diagnoses::print(std::ostream& out)const{
out<<"\nID : "<<id
<<"\nDisease name : "<<disease_name;
}
void Diagnoses::read(std::istream& in){
string temp;
id=randomStringGenerator(48,57,4,0);
getline(in,temp);
getline(in,disease_name);
}