#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <fstream>
using namespace std;
int main()
{
struct process
{
int burst;
int ar;
};
int x = 4;
int arival[x];
int burst[x];
ifstream arrival, burrst;
arrival.open("arrival.txt");
burrst.open("burrst.txt");
for (int i = 0; i<x; i++)
{
arrival >> arival[i];
burrst >> burst[i];
}
arrival.close();
burrst.close();
vector<process> a[x];
for (int i = 0; i<x; i++)
{
a[i].push_back({ burst[i], arival[i] });
}
cout << "Process\t" << "Arrival Time\t" << "Burst Time\n";
for (int i = 0; i<x; i++)
{
char k = 'A';
cout << k << "\t" << a[i].back().burst << "\t" << a[i].back().ar << endl;
}
queue<process> wait, ready; /* Declare a queue */
wait.push(a[1]);
return 0;
}
The compiler is not allowing me to push vector value into queue When I try to insert a[1]
in wait queue like this:
wait.push(a[1]);
I get the following error
invalid arguments
Please have a look and help me to remove the error.