資源簡介
一個用c++編的簡單的通訊錄程序 入門的可以參考一下 很簡單的 看看就能懂得 有運行程序 可以測試能不能用

代碼片段和文件信息
/*
??Name:?實現文件?
??Copyright:?
??Author:?荊志奇?
??Date:?21/05/09?22:16
??Description:?
*/
#include
#include?“person.h“//頭文件的庫?
#include
#include//文件的輸入和輸出流的庫?
#include//exit()的庫
//#include//setw()的庫?
#include?//這個庫用來設置密碼;
using?namespace?std;?
Information::Information():head(NULL)//用來初始化鏈表?
{
?????//有意留空?????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????
}
Information::~Information()//析構函數,用來釋放自由內存空間?
{
???????if(head!=NULL)
???????delete?head;
}??????????????????
void?come()//用來訪問head使其指向表頭?
{
?????Information?s;
?????s.head=new?person;
}
void?Information::creat()
?{
?????
??????
??????intptr?here;
??????here=new?person;
??????//head=new?person;?
??????
??????cout<<“********************注意不能輸入空格!*********************\n“;?
??????cout<<“請添加聯系人信息\n“;
??????cout<<“\t\t姓名:“;
??????cin>>here->name;?
??????cout<<“\t\t性別:“;
??????cin>>here->sex;
??????cout<<“\t\t年齡:“;
??????cin>>here->age;
??????cout<<“????????????電話號碼:“;
??????cin>>here->num;?
??????cout<<“\t\tQQ號:“;
??????cin>>here->QQ;
??????here->link=head;
??????head=here;
?????//?delete?here;
}
//按姓名查找?
void?Information::search1()
{
????
????intptr?here=head;
????string?the_name;
????cout<<“輸入要查找的姓名:“;
????cin>>the_name;
????if(here==NULL)
????cout<<“搜索完畢,沒有您要的信息。\n“;
????else
????{
???????
???????while(here->name!=the_name&&here->link!=NULL)
???????here=here->link;
???????if(here->name==the_name)
???????{
????????cout< ????????cout<<“\t\t性別:“;
????????cout<sex< ????????cout<<“\t\t年齡:“;
????????cout<age< ????????cout<<“????????????電話號碼:“;
????????cout<num< ????????cout<<“\t\tQQ號:“;
????????cout<QQ< ???????}
???????else
???????cout<<“對不起,沒有您想要的信息!\n“;
????}
//delete?here;
}??????
//按號碼查詢?
void?Information::search2()
{
????
????intptr?here=head;
????string?the_num;
????cout<<“輸入要查找的電話號碼:“;
????cin>>the_num;
????if(here==NULL)
????cout<<“搜索完畢,沒有您要的信息。\n“;
???
????else
????{
???????
???????while(here->num!=the_num&&here->link!=NULL)
???????here=here->link;
???????if(here->num==the_num)
????????{
????????cout< ????????cout<<“\t\t姓名:“;
????????cout<name< ????????cout<<“\t\t性別:“;
????????cout<sex< ????????cout<<“\t\t年齡:“;
????????cout<age< ????????cout<<“\t\tQQ號碼:“;
????????cout<QQ< ????????}
??????else
??????cout<<“對不起,沒有您想要的信息!\n“;
????}?
?//delete?here;
}
//修改聯系人函數?
void?Information::modify()?
{
?????
????
?????intptr?here=head;
?????string?the_name;
?????cout<<“********************注意不能輸入空格!*********************\n“;?
?????cout<<“輸入您想要更改的聯系人姓名:\n“?;
?????cin>>the_name;????
?????if(here==NULL)
?????cout<<“搜索完畢,沒有您要的信息。\n“;
?????else
????{
???????
???????while(here->name!=the_name&&here->link!=NULL)
?????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????206??2009-06-04?21:48??程序\infile.txt
?????文件???????1107??2009-06-04?22:07??程序\Makefile.win
?????文件???????1414??2009-06-03?18:29??程序\person.h
?????文件???????6166??2009-06-04?22:07??程序\實現文件.cpp
?????文件??????14946??2009-06-04?22:07??程序\實現文件.o
?????文件???????6298??2009-06-04?21:19??程序\應用程序.cpp
?????文件???????8445??2009-06-04?21:19??程序\應用程序.o
?????文件???????1160??2009-05-21?23:05??程序\簡單的通訊錄應用程序.dev
?????文件?????486949??2009-06-04?22:07??程序\簡單的通訊錄應用程序.exe
?????目錄??????????0??2009-12-28?18:40??程序
-----------?---------??----------?-----??----
???????????????526691????????????????????10
- 上一篇:熱電偶-熱電阻分度表
- 下一篇:距離向量DV算法實現
評論
共有 條評論