creating members in a class

How to create members for four intergers of an internet address and fifth member to store an associated nickname of 10 char and to make sure the program read a list of up to 100 addresses and nicknames terminated by a sentinel address of all zeros and nickname none. my data will be stored in a text file.
this will be for a class called:

class myAddres
{
Have you tried Google "C++ class tutorial"?
yes but i dont get how to declare the member for the text files.
Do you know of a link that explain this?
Do anyone know what i member function of a class would be if the class is reading from a text file.
Last edited on
Call it whatever you want...or if you want to go the more intuitive route, overload operator <<
I was wandering if it was needed a cerntain data type or to create an array if it is reading this type of data from a file

111.22.3.3 " green" and this should all be display on one line
Here is the problem I'm trying to solve can someone please please HELP please

1. SPLIT THE PROGRAM IN 3 FILE NETWORK. H, NETWORK.CPP. CLIENTNET.CPP AS IN ADT(DONE)

2. DEFINE A CLASS CALLED address_t (done) with member for the four integers of an internet address and a fifth member in which to store an associated nickname of 10 characters. The program should read a list of 100 address and nicknames terminated by a sentinel address of all zeros and a nickname “none”. The data will be already stored a file called data.txt.
3. Define and implement a member function CompareTo , which should take2 network addresses and compare them.
4. Include exceptions handling in the code. The program need 2 exception, (1) if the data file not found and it should also ask the user to enter a different file name(2)another exception to handle the case where one of the network is a negative number and skips to the next file entry.

The CAPed parts are done

Ex of data .txt file
111.22.2.44 platte
555.66.7.88 wabash
111.22.5.66 green
222.334.5.77 blue
777.88.9.99 purple
555.22.789.00 black
0.0.0.0 none
2.
You want to have a class with members like:
class address_t {
private:
int addressPrt1;
int addressPrt2;
int addressPrt3;
int addressPrt4;
char[10] nickname;
}
Then an overloaded constructor to assign the values.

3.
class address_t {
public:
int CompareTo(address_t &target);
}

etc..
Topic archived. No new replies allowed.