c++电话本程序

这是一个使用C++编写的电话本管理程序,包括搜索、添加、删除、查看、文件操作等功能。用户可以通过菜单交互式地进行电话簿的操作,如搜索特定联系人、添加新联系人、删除联系人、显示所有联系人等。程序通过读写文本文件来存储和加载电话本数据。
摘要由CSDN通过智能技术生成

电话本的功能在menu菜单里完全体现了:

cout << "这是一个电话本程序,可以执行以下操作:" << endl;

         cout << "1->搜索一个电话" << endl;

         cout << "2->增加一个电话" << endl;

         cout << "3->删除一个电话" << endl;

         cout << "4->查看电话本" << endl;

         cout << "5->将文件追加到“电话本.txt”后面" << endl;

         cout << "6->将文件读到内存并且输出到命令行" << endl;

         cout << "7->清屏" << endl;

         cout << "0->退出" << endl;

 

 

 


 

  1. #include"iostream"
  2. #include"cstdlib"
  3. #include"string"
  4. #include"fstream"
  5. #include"utility"
  6. #include"vector"
  7. #include"windows.h"
  8. using namespace std;
  9.  
  10. class number
  11. {
  12. private:
  13.          string name;
  14.          string num;
  15. public:
  16.          void search(string);
  17.          void add();
  18.          void del(string);
  19.          void show(string);
  20.          void copy();
  21.          friend ostream &operator <<(ostream &output,const number &p)
  22.          {
  23.                    output << p.name << endl;
  24.                    output << p.num << endl;
  25.                    return output;
  26.          }
  27.          
  28.          void input()
  29.          {
  30.                    cout << "请输入姓名:" << endl;
  31.                    cin >> name;
  32.                    cout << "请输入电话:" << endl;
  33.                    cin >> num;
  34.          }
  35.          number(string name1=" ",string num1=" ")
  36.          {
  37.                    this->name = name1;
  38.                    this->num = num1;
  39.          
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值