#include<iostream>#include<string>using namespace std;class Id{public:Id(){};int tel;void init(){cout<<name<<" "<<tel<<endl;}void del(){}void print(){cin>>name>>tel;}void ct(){cin>>name>>tel;}};int main(){cout<<"请输入查看(check),查看全部(checkall),增添(add),修改(change)或删除(delete)"<<endl;Id a[10];string b;int n;while(cin>>b){if(b=="add"){cout<<"请输入您要增添几位联系人(但请不要超过十人):"<<endl;cin>>n;for(int i=0;i<n;i++)a[i].print();cout<<"请输入查看(check),查看全部(checkall),增添(add),修改(change)或删除(delete)"<<endl;}else if(b=="checkall"){cout<<"请输入您要查看几位联系人:"<<endl;cin>>n;for(int i=0;i<n;i++)a[i].init();cout<<"请输入查看(check),查看全部(checkall),增添(add),修改(change)或删除(delete)"<<endl;}else if(b=="check"){cout<<"请输入您要查看第几位联系人:"<<endl;cin>>n;for(int i=n-1;i<n;i++)a[i].init();cout<<"请输入查看(check),查看全部(checkall),增添(add),修改(change)或删除(delete)"<<endl;}else if(b=="change"){cout<<"请输入您要修改第几位联系人:"<<endl;cin>>n;for(int i=n-1;i<n;i++)a[i].ct();cout<<"请输入查看(check),查看全部(checkall),增添(add),修改(change)或删除(delete)"<<endl;}else if(b=="delete"){cout<<"请输入您要删除第几位联系人:"<<endl;cout<<"请输入查看(check),查看全部(checkall),增添(add),修改(change)或删除(delete)"<<endl;}}}
目前暂无任何回答
- 0 回答
- 0 关注
- 1405 浏览
添加回答
举报
0/150
提交
取消