1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#include <iostream>
#include <string>
#include <list>
#include <fstream>
#include <cstddef>
#include <cstdlib>
#include <iterator>
using namespace std;
class Item
{
private:
int time, dist, index, deadline;
public:
Item(int time=0, int dist=0, int index=0, int deadline=0):time(time),dist(dist), index(index), deadline(deadline) {}
int Time()const { return time; } //a
int Dist()const { return dist; } //b
int Index()const { return index; } //c
int Deadline()const { return deadline; } //d
};
int main()
{
list<Item> Lst2;
int a=0,b=0,c=0,d=0,n=0;
ifstream filee;
filee.open("tasks.txt", ios::in);
filee>>n;
for(int i=0; i<n; i++)
{
filee >> a >> b >> c >> d;
Lst2.push_back(Item(a,b,c,d));
}
filee.close();
for(list<Item>::iterator i=Lst2.begin();i!=Lst2.end();++i)
{
cout<<i->Time()<< " " <<i->Dist()<< " " <<i->Index()<< " " <<i->Deadline()<<endl;
}
return 0;
}
|