creating object in c++ using input file -


i familiar java , c++ not strong spot..

i trying write algorithm cpu scheduler of code syntax error free stuck 1 problem.

my program uses 2 classes process , processqueue

my main looks this

int main(){      fstream f;      processqueue pq;      f.open("input.txt");      if (!f)     {         cout << "file not found";     }else{     int noofprocess;      f >> noofprocess;     process *p;     p = new process[noofprocess];      (int = 0;i<noofprocess;i++){         int arivaltime;         int cputime;         int proritynumber;          f >> arrivaltime;         f >> cputime;         f >> proritynumber;          p[i] = new process(arrivaltime,cputime,proritynumber);     } return 0; } 

but p[i] causing trouble.. not able use parametric constructor,setters.

it gives following error

enter image description here

change

p[i] = new process(arrivaltime,cputime,proritynumber); 

to

p[i] = process(arrivaltime,cputime,proritynumber); 

as p[pi] of type process

also use std::array or str::vector


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -