From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../Praktikum1/Aufgabe3/src/main.cpp | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Master/Real-Time Systems/Praktikum1/Aufgabe3/src/main.cpp (limited to 'Master/Real-Time Systems/Praktikum1/Aufgabe3/src/main.cpp') diff --git a/Master/Real-Time Systems/Praktikum1/Aufgabe3/src/main.cpp b/Master/Real-Time Systems/Praktikum1/Aufgabe3/src/main.cpp new file mode 100644 index 0000000..c616f9b --- /dev/null +++ b/Master/Real-Time Systems/Praktikum1/Aufgabe3/src/main.cpp @@ -0,0 +1,99 @@ +/* + * main.cpp + * + * Created on: 31.10.2010 + * Author: sven + */ +#ifndef GLOBAL_H_ + #include "Global.h" +#endif +#ifndef TASK_H_ + #include "Task.h" +#endif +#ifndef RMSSCHEDULER_H_ + #include "RMSScheduler.h" +#endif +#ifndef DMSSCHEDULER_H_ + #include "DMSScheduler.h" +#endif +#ifndef EDFSCHEDULER_H_ + #include "EDFScheduler.h" +#endif +#ifndef RESPONSETIMEANALYSIS_H_ + #include "ResponseTimeAnalysis.h" +#endif + +#include +#include +#include +#include + +const char* TASKS_FILE_NAME = "tasks.txt"; + +int lcm(int,int); +int gcd(int,int); +int load_tasks(const char*,task_set&); + +int main(int argc,char* argv[]) +{ + int ci = 1; + task_set tasks; + load_tasks(TASKS_FILE_NAME,tasks); + for(uint i=0;i> name >> c >> p >> d; + if(name[0] != 0) { + Task t(&name[0],c,p,d); + tasks.push_back(t); + } + } + task_file.close(); + return EXIT_SUCCESS; +} +// Least Common Multiple +int lcm(int a, int b) +{ + return (a*b)/gcd(a, b); +} +// Greatest Common Divisor +int gcd(int a, int b) +{ + if(b == 0) + { + return a; + } + if(a == 0) + { + return b; + } + return gcd(b, a%b); +} -- cgit v1.2.3