Home > Back-end >  Class C address book management system
Class C address book management system

Time:12-03

Can help us have a look at where the problem, has been run out
The design of the contacts/*
Basic requirements:
Define the date class, including at least (date) (month) (year);
Define the person class, at least, including name, gender and date of birth;
Define staff (staff) class, derived from the person class, at least including telephone, address, postal code, E-mail, QQ number and category (for example: the classmates, friends, etc.),
Functional requirements:
1, design menu select functionality;
2, the input functions: the input information, and saved to a file;
3, the query function:
1) based on name, telephone precise query personnel information;
2) according to address fuzzy query personnel information;
3) according to the category query personnel information
4, according to the names of personnel information output
5, can modify the personnel information according to the name, phone
6, can according to the name, telephone deleted personnel information
*/

# include
# include
# include
# include
# include
using namespace std;

The class date
{
Private:
Int year, month, day.
Public:
Date () {}
The date (int a, b int, int) c: year, (a) the month (b), day (c)
{
Cout & lt; <"WWW" & lt; }
The date (date & amp; M)
{
Year=m.y ear;
The month=m.m onth.
Day=m. ay;
}
Void set_date ()
{
Cout & lt; <"Please enter the date of birth:" & lt; Cin & gt;> Year & gt;> The month & gt;> Day;
}
Void show_date ()
{
Cout & lt; <"Date of birth is:" & lt; }
To date () {}
};
The class person
{
Private:
String name;
String sex;
The date birthday;
Public:
The person () {}
Person (string x, string y) : name (x), sex (y), birthday ()
{
Cout & lt; <"With and function has been called" & lt; }
Void set_person ()
{
Cout & lt; <"Please input your name:" & lt; Cin & gt;> The name;
Cout & lt; <"Please enter the gender:" & lt; Cin & gt;> sex;
Birthday. Set_date ();
}
Void show_person ()
{
Cout & lt; <"Name is:" & lt; Cout & lt; <"Sex is:" & lt; Birthday. Show_date ();
}
To the person (s)
{
Cout & lt; <"Aaa" & lt; }
Void set_name (string g)
{
Name=g;
}
String get_name ()
{
return name;
}
};

Class staff: public person
{
Private:
String telephone;
String address;
Int post_code;
String mailbox;
String qq;
String category;
The person people;
Public:
The staff () {}
Staff (string x, string y, string tel, string add, string mai, int pos, string q, string cat) : person (x, y), telephone (tel), address (add), post_code (pos), mailbox (mai), qq (q), category (cat)
{

}
Void set_staff ()
{
People. Set_person ();
Cout & lt; <"Please enter the phone number:" & lt; Cin & gt;> The telephone;
Cout & lt; <"Please enter the address:" & lt; Cin & gt;> The address;
Cout & lt; <"Please enter the zip code:" & lt; Cin & gt;> Post_code;
Cout & lt; <"Please enter the email:" & lt; Cin & gt;> mailbox;
Cout & lt; <"Please enter the QQ number:" & lt; Cin & gt;> Qq;
Cout & lt; <"Please enter the category:" & lt; Cin & gt;> The category;
}
Void set_telephone (string BBB)
{
Telephone=BBB;
}
String get_telephone ()
{
Return the telephone;
}
Void set_address (string add)
{
Address=add;
}
String get_address ()
{
The return address.
}
Void set_category (string cat)
{
Category=cat;
}
String get_category ()
{
Return the category;
}
Void show_staff ()
{
People. Show_person ();
Cout & lt; <"The phone number is:" & lt; Cout & lt; <"The address is:" & lt; Cout & lt; <"The postal code is:" & lt; Cout & lt; <"Email address is:" & lt; Cout & lt; <"QQ number is:" & lt; Cout & lt; <"Category is:" & lt; }

};
The class stafftool
{
Public:
Friend class staff;
Void show_menu that demonstrates ()
{
Cout & lt; <- welcome to the use of address book management system - "& lt; Cout & lt; <"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -" & lt; Cout & lt; <"1. Input staff information" & lt; Cout & lt; <"2. According to the name or telephone query information" & lt; Cout & lt; <"3. According to the address query information" & lt; Cout & lt; <"4. According to the category query information personnel" & lt; Cout & lt; <5. According to the name "to sort the output information" & lt; Cout & lt; <"6. According to the name or telephone to modify information" & lt; Cout & lt; <"7. According to the name or telephone number deleted information" & lt; Cout & lt; <"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -" & lt; }
vector V.
vector V1.
vector : : iterator it;
Int search_staff ()//2. According to the name or telephone query information
{
Int h;
The string s, k;
Long len.
Len=v. considering ();
Cout & lt; <"Please enter a search method: 1. The name lookup 2 phone number lookup" & lt; Cin & gt;> h;
If (h==0)
{
Cout & lt; <"Wrong!" return 0;
}
Else if (h==1)
{
Cout & lt; <"Please enter a name to find:" & lt; Cin & gt;> s;
For (int I=0; I & lt; V. considering (); I++)
{
If (v [I] get_name ()==s)
{
Cout & lt; <"Information is:" & lt; V [I] show_staff ();
}
The else
{
Cout & lt; <"No such person!" }
}
}
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related