ok kesikiverto for
while(infile >> contacts[i].id >> contacts[i].contact >> contacts[i].start >> contacts[i].end >> contacts[i].distance)
a mate of mine told me that structs and classes amend to the same principle so I tried to do it the same way I did the struct but that resulted in errors so then I changed it.
I dont know how to implement that function
double getDuration() const { return end - start; }
.Do I just it have outside the class ?? as a function on its own?
currently my class looks like this
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
|
class Contacts
{
public:
//construct and decon
//functions
Contacts();//Constructor
~Contacts(); //Destructor
//setter
void setid(float id);
void setcw(float cw);//contact_with
void setcs(float cs);//call start
void setce(float ce);//call end
void setdist(float dist);//distance
void setdur(float dur);//duration
//getter
float getid();
float getcw();
float getcs();
float getce();
float getdist();
float getdur();
private:
//varaibles
float id, cw, cs, ce, dur, dist;
//dur = ce - cs;
};
| |
I have no problem reading in the txt and displaying the contents which is id,contact_with, call_start, call_end and distance of the file but i am required to only display the id,contact_with distance and replace call_start, call_end with call_duration
and for those curious this is what the text file looks like
user_id contact_with contact_start contact_end distance(cm)
1011 1010 1630731125 1630731129 202
1009 1010 1630718920 1630719418 309
I have to find the duration for each record.