#include <string>
#include <iostream>
using namespace std;
void init();
// proc store the process name
static string * proc = new string[5];
// exetime store the execution time
static int * exetime = new int[5];
// prio store the priority
static int * prio = new int[5];
int main(int argc, char* argv[])
{
init();
return 0;
}
// read input.txt file
void init()
{
char * name = "input.txt";
// open file
FILE *infile = fopen(name, "r");
if (!infile)
{
/* the operation was unsuccessful */
printf("unable to open %s/n", name);
exit(1); /* end the program */
}
int scantime = 0;
int line = 0;
int colum = 0;
char a[3];
int in ;
int readtime = 0;
do
{
line = scantime / 3;
colum = scantime % 3;
scantime++;
if (colum == 0)
{
// proc is string type
fscanf(infile, "%s",a);
// fscanf(infile, "%s",&proc[line]);
proc[line] = a;
}
if (colum == 1)
{
// exetime is int type
fscanf(infile, "%d", &in);
exetime[line] = in;
}
if (colum == 2)
{
// prio is int type
fscanf(infile, "%d", &in);
prio[line] = in;
}
// read 15 times
readtime++;
} while ( readtime != 15 );
// close file
fclose(infile);
}