-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.cpp
More file actions
71 lines (58 loc) · 2.11 KB
/
Copy pathDriver.cpp
File metadata and controls
71 lines (58 loc) · 2.11 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
//
// Created by altanai on 08/02/21.
//
/*
* Driver.cpp
* This is the driver for the scheduling program. It provides prompts to
* the user and displays information.
*/
//#include "SJF.h"
//#include "SRTF.h"
//#include "ProcessRR.h"
#include "Processes.h"
#include "Roundrobin.h"
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
//main method that displays information and prompts user
int main() {
string another;
do {
cout << "\n Input name of file with data: ";
string fileName;
getline(cin, fileName);
ifstream infile;
infile.open(fileName);
if (infile.fail()) {
cout << "ERROR: file note found!" << endl;
break;
}
// cout << "\nHere are the scheduling algorithms for the file " << fileName << "." << endl;
// cout << "\nShortest Job First (SJF)" << endl;
// SJF sjf;
// sjf.getFileData(fileName);
// cout << "\nAverage Waiting Time= " << sjf.getAverageWaitingTime() << endl;
// cout << "Average Throughput= " << sjf.getThroughput() << endl;
// cout << "Average Turnaround Time= " << sjf.getAverageTurnaroundtime() << endl;
// cout << "\n";
cout << "Round Robin (RR)" << endl;
Roundrobin rr;
cout << "Order: ";
rr.getFileData(fileName);
cout << "\n Average Waiting Time= " << rr.getAverageWaitingTime() << endl;
cout << "Average Throughput= " << rr.getThroughput() << endl;
cout << "Average Turnaround Time= " << rr.getAverageTurnaroundtime() << endl;
cout << "\n";
// cout << "Shortest Remaining Time (SRTF)" << endl;
// SRTF srtf;
// srtf.getFileData(fileName);
// cout << "\nAverage Waiting Time= " << srtf.getAverageWaitingTime() << endl;
// cout << "Average Throughput= " << srtf.getThroughput() << endl;
// cout << "Average Turnaround Time= " << srtf.getAverageTurnaroundtime() << endl;
// cout << "\n";
cout << "\nDo you want to test another file? y/n: ";
getline(cin, another);
} while (another == "y");
cout << "\n";
}