}
void AddressBook::loadRecords(){
cout<<"1"<<SPACE<<"使用默认文件。"<<endl;
cout<<"2"<<SPACE<<"使用自定义文件。"<<endl;
cout<<"3"<<SPACE<<"返回"<<endl;
switch(menuSelect()){
case '1':{
cout<<"1"<<SPACE<<"覆盖当前内容"<<endl;
cout<<"2"<<SPACE<<"追加到当前文件"<<endl;
switch(menuSelect()){
case '1':
AddressList::clear();break;
case '2':break;
}
ifstream file("default");
AddressList::loadRecords(file);
file.close();
}break;
case '2':{
cout<<"请输入文件名:"<<endl;
string fname;
cin>>fname;
www.751com.cn
}break;
case '3':break;
}
}
void AddressBook::clear(){
cout<<"是否要清除内存中所有内容?(Y/N)"<<endl;
switch(menuSelect()){
case '1':AddressList::clear();break;
case '2':break;
}
}
void AddressBook::quit(){
cout<<"是否要保存文件?(Y/N)"<<endl;
switch(menuSelect()){
case'1':saveRecords();break;
case'2':break;
}
exit(0);
} int main(int argc, char *argv[])
{
AddressBook a;
a.start();
system("PAUSE");
return EXIT_SUCCESS; }
上一页 [1] [2] [3] [4] [5] [6] [7]