![]() |
Beginner problem
Okay what i want to do is:
Code the implementation of a Person class (2 person object are equal if they have the same name) (b) Code the implementation of a Worker class (c) The program must read in the name, age and workplace (comma delimited) from the console in to a Worker object and store in a vector. What i have done so far is: Code:
#include <iostream> |
Re: Beginner problem
Can you point as to where you are stuck because its very difficult to go through the entire code.
|
Re: Beginner problem
I have managed to figure out what i needed i would like to know how would i read a files values into my program that are comma deliminated. Like:
"David",23,"XPlace" And does it matter if there are spaces when you reading in the information ANy help greatly appreciated, |
Re: Beginner problem
Well i got most of everything working with a little work. Like this:
Code:
#include <iostream> |
Re: Beginner problem
ifstream in;
in.read(buf,Num); Where buffer is where the content is read and num is the no of bytes read. So if I am getting you correctly this should read it from the file. |
Re: Beginner problem
Quote:
|
Re: Beginner problem
sorry but i dont understand im new, but how will that read infomration comma sperated it does not work for me
|
Re: Beginner problem
Why it shouldn't. Here is the sample code
Code:
#include <iostream.h> |
Re: Beginner problem
no i get that its just i want to use the data to store in an object.
like : "darrel","xWork",34 Then store darrel xWork and 34 in the object |
Re: Beginner problem
After you read it into buf convert it to whatever object you wish.
|
| All times are GMT +5.5. The time now is 15:54. |