C鎵嬫満閫氳褰曡绋嬭璁℃姤鍛婁功 - 鐧惧害鏂囧簱 联系客服

发布时间 : 星期四 文章C鎵嬫満閫氳褰曡绋嬭璁℃姤鍛婁功 - 鐧惧害鏂囧簱更新完毕开始阅读e31163e06d1aff00bed5b9f3f90f76c661374c6f

}

case 1: }

if(p==NULL) } }

cout<<\删除的联系人不存在!\<

cout<<\输入错误!\<

if(strcmp((p->data).name,nam)==0) { } else {

while(p!=NULL) {

if(strcmp((p->data).name,nam)==0) { }

q->next=p->next;

cout<<\删除成功!\<

first->next=p->next; cout<<\删除成功!\<

q=p; p=p->next; }

case 2: default:

template

void Telebook :: printdata()//浏览记录 {

Node *p=first; first->next=NULL;

ifstream infile(\,ios::in); if(!infile) { }

string ph,ma;

char nam[10],addr[20];

while(infile.good())//判断文件是否被读完 { }

infile.close();

Node *t=first->next; cout<

cout<<\cout<<\;

cout<

cout<

cout<data).name<<\<data).address<<\

<data).phone<<\<data).mail<<\infile>>nam>>addr>>ph>>ma; DataType a(nam,addr,ph,ma);

Node *s=new Node ; s->data=a; p->next=s; s->next=NULL; p=s;

cout<<\联系人浏览失败!\<

------\<

\<

\<

t=t->next;

cout<<\}

------\<

}

template

void Telebook :: save()//保存到文件 { }

源文件(main.cpp):

#include #include%using namespace std; void main() {

bool flag=true;

Node *p =first->next; ofstream outfile(\,ios::out); if(!outfile) { } int i=0; while(p!=NULL) {

if(p->next==NULL) }

outfile.close();

{ } else { } p=p->next;

outfile<<(p->data).name<<\<<(p->data).address<<\<<(p->data).phone<<\<<(p->data).mail<data).name<<\<<(p->data).address<<\

<<(p->data).phone<<\<<(p->data).mail;//最后一个不应该换行, //否则读记录时将多一行 break;

cout<<\联系人保存失败!\<

Telebook telebook;//调用无参构造函数 telebook.main_menu(); while(flag){

int t;

cout<<\请选择您的选择(0-8)[按返回主菜单]:\; if(cin>>t){}//检验异常 else { }

switch(t) { case 1:

telebook.main_menu(); break;

telebook.add(); telebook.save(); break;

telebook.delet(); telebook.save(); break;

telebook.printdata(); break;

telebook.set(); telebook.save(); break;

telebook.lenth(); break;

telebook.search(); break;

cout<<\输入错误!\<

case 2:

case 3:

case 4:

case 5:

case 6:

case 7: