请用C++编写如下程序 我会追加的!!!急

来源:百度知道 编辑:UC知道 时间:2024/06/15 02:51:09
编写学生列表程序StuMag。
输入若干学生信息 如姓名、学号、院系、籍贯,存入列表,然后输出

把如下程序中的List抽象数据类型定义成类List
修改list.h 按如下方式定义Item:
struct Person
{
char name[20];
char relationShip[20];
char address[50];
char phone[20];
};
typedef Person Item;

完成教材184页综合实例6-24中的类Date。抄
完成教材第194页编程题2中的类Student的定义。编

把下面的文件用WinRar压缩成一个文件StuMag.rar后提交
类List的定义文件:List.h, List.cpp
类Date的定义文件:Date.h, Date.cpp
类Student的定义文件:Student.h, Student.cpp
学生列表程序主控代码文件:StuMag.cpp

#include <list>
#include <iostream>
#include <iomanip>
using namespace std;

struct Person
{
string m_name;
string m_relationShip;
string m_address;
string m_phone;
};
typedef Person Item;

int main()
{
list<Item> aItem;
while(true)
{
cout<<"输入name, relationShip, address, phone(用空格格开,输入-1结束):"<<endl;
string name, relationShip, address, phone;
cin>>name;
if ("-1" == name) break;
cin>>relationShip>>address>>phone;
Item item;
item.m_name = name;
item.m_relationShip = relationShip;
item.m_address = address;
item.m_phone = phone;
aItem.push_back(item);
}
cout<<setw(10)<<"name"
<<setw(20)<<"relationShip"
<<setw(15)<<"address"
<<setw