-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
39 lines (28 loc) · 829 Bytes
/
main.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
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include "bibliothiki.h"
using namespace std;
int main(int argc, char const *argv[])
{
int K1,K2, NMax, L, random_number;
srand (time(NULL));
NMax = atoi(argv[1]);
L = atoi(argv[2]);
K1 = atoi(argv[3]);
K2 = atoi(argv[4]);
bibliothiki bibl(NMax); //na dimioyrgei mia bibliothiki
for (int i = 0; i < L; ++i){
biblia.b(creat_random_title(), creat_random_name(), creat_random_name()) //na dimioyrgei L biblia (isos ginei struct)
}
for(i = 0; i<K1; i++){ //k1 tyxaies topothetiseis
random_number = rand() % 5 + 1;
bibl.place_book(random_number, &b);
}
for(int i = 0; i < K2; i++){ //k2 tyxaies afaireseis
random_number = rand() % 5 + 1;
bibl.take_book(random_number);
}
bibl.print(); //ektyposh ths bibliothikis
return 0;
}