I am trying to make an FCFS algorithm. I start with making a program that will evaluate which the least time is. The codes I'm using the code I learn in class. If you'll ask why I didn't try other codes or copy what I can find in the internet, it is because I need to defend my code in front of my instructor to prove that I am the one who made the program and prove that I know how the program works. This is my code:
#include <iostream>
using namespace std;
int main()
{
int pro[6];
int job[6];
int time[6];
int first;
int know;
int val00;
int val01;
int val02;
cout<<"Enter six jobs with their time of arrival and process time"<<endl;
for(int val00=0; val00<6; val00++)
{
cout<<"Job"<<val00+1<<endl;
cout<<endl<<"Time of Arrival:"<<endl;
cin>>time[val00];
cout<<endl<<"Process Time:"<<endl;
cin>>pro[val00];
cout<<endl;
}
if(time[val00]<time[val00+1])
{
first=time[val00];
for(int val01=val00+2; val01<6; val01++)
{
if(first<time[val01])
{
know=first;
}
else
{
first=time[val01];
know=first;
}
}
cout<<know;
for(int val02=0; val02<6; val02++)
{
if(know=time[val02])
{
cout<<"Job"<<val02;
}
}
}
else
{
first=time[val00+1];
for(int val01=val00+2; val00<6; val00++)
{
if(first<time[val01])
{
know=first;
}
else
{
first=time[val01];
know=first;
}
}
cout<<know;
for(int val02=0; val02<6; val02++)
{
if(know=time[val02])
{
cout<<"Job"<<val02;
}
}
}
}