国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

網(wǎng)絡(luò)通訊錄服務(wù)器

這篇具有很好參考價(jià)值的文章主要介紹了網(wǎng)絡(luò)通訊錄服務(wù)器。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

六、通訊錄4.0實(shí)現(xiàn)—?絡(luò)版

簡(jiǎn)易版本

服務(wù)端完整版本

客戶端完整版本

Protobuf還常?于通訊協(xié)議、服務(wù)端數(shù)據(jù)交換場(chǎng)景。那么在這個(gè)?例中,我們將實(shí)現(xiàn)?個(gè)?絡(luò)版本的
通訊錄,模擬實(shí)現(xiàn)客?端與服務(wù)端的交互,通過(guò)Protobuf來(lái)實(shí)現(xiàn)各端之間的協(xié)議序列化。
需求如下:

  • 客?端可以選擇對(duì)通訊錄進(jìn)?以下操作:

    • 新增?個(gè)聯(lián)系?
    • 刪除?個(gè)聯(lián)系?
    • 查詢通訊錄列表
    • 查詢?個(gè)聯(lián)系?的詳細(xì)信息
  • 服務(wù)端提供增刪查能?,并需要持久化通訊錄。

  • 客?端、服務(wù)端間的交互數(shù)據(jù)使?Protobuf來(lái)完成。

如下圖:

  • 客戶端要有一個(gè)菜單,新增一個(gè)聯(lián)系人…
  • 每個(gè)功能都有一對(duì)請(qǐng)求和響應(yīng)協(xié)議.
  • 例如實(shí)現(xiàn)新增一個(gè)聯(lián)系人,首先我們要設(shè)計(jì)message, 中間是網(wǎng)絡(luò)傳輸.
  • 然后安裝圖形序號(hào)執(zhí)行,客戶端完成:1,2,3,7 ; 服務(wù)端完成:1,4.5,6

網(wǎng)絡(luò)通訊錄服務(wù)器,序列化工具,網(wǎng)絡(luò),服務(wù)器,運(yùn)維

1. 環(huán)境搭建

1.1 安裝Httplib庫(kù)

Httplib庫(kù):cpp-httplib是個(gè)開(kāi)源的庫(kù),是?個(gè)c++封裝的http庫(kù),使?這個(gè)庫(kù)可以在linux、windows平臺(tái)下完成http客?端、http服務(wù)端的搭建。

使?起來(lái)?常?便,只需要包含頭?件 httplib.h即可。編譯程序時(shí),需要帶上-lpthread選項(xiàng)。

源碼庫(kù)地址:https://github.com/yhirose/cpp-httplib
鏡像倉(cāng)庫(kù):https://gitcode.net/mirrors/yhirose/cpp-httplib?utm_source=csdn_github_accelerator

1.1升級(jí) gcc

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-
bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-
zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --
enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-
c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --
with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --
with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install -
-enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-
redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
cpp-httplib 用老的編譯器,要么編譯不通過(guò),要么直接運(yùn)行報(bào)錯(cuò)
百度搜索:scl gcc devsettool升級(jí)gcc
//安裝scl
$ sudo yum install centos-release-scl scl-utils-build
//安裝新版本gcc,這里也可以把7換成8或者9,我用的是9,也可以都安裝
$ sudo yum install -y devtoolset-7-gcc devtoolset-7-gcc-c++
$ ls /opt/rh/
//啟動(dòng): 細(xì)節(jié),命令行啟動(dòng)只能在本會(huì)話有效
$ scl enable devtoolset-7 bash
$ gcc -v
//可選:如果想每次登陸的時(shí)候,都是較新的gcc,需要把上面的命令添加到你的~/.bash_profile中
$ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
#添加下面的命令,每次啟動(dòng)的時(shí)候,都會(huì)執(zhí)行這個(gè)scl命令
scl enable devtoolset-7 bash
or
scl enable devtoolset-8 bash
or
scl enable devtoolset-9 bash

2. 搭建簡(jiǎn)單的服務(wù)器

用來(lái)測(cè)試httplib

Client.cpp

#include"httplib.h"
#include<iostream>
#include<string>
using namespace std;
using namespace httplib;

const string IP = "127.0.0.1";// 監(jiān)聽(tīng)所有的ip
//const string IP = "192.139.99.192";

const int PORT = 6666; 
int main()
{
  Client client(IP.c_str(),PORT);
  // 傳輸./test-Post 資源
  Result res1 = client.Post("./test-Post");
  if(res1->status ==200){
    cout<<"post sucess Post"<<endl;
  }
  // 請(qǐng)求./test-Post 資源
  Result res2 = client.Get("./test-Get");
  if(res2->status ==200){
    cout<<"get sucess Get"<<endl;
  }
}

Server.cpp

#include"httplib.h"
#include<iostream>
#include<string>
using namespace std;
using namespace httplib;
const string IP = "127.0.0.1";

//const string IP = "0.0.0.0";
//const string IP = "192.139.99.192";

const int PORT = 6666; 
int main()
{
  Server svr;
  // 注冊(cè)post處理方法

  svr.Post("./test-Post",[](const Request& req ,Response& res){
      cout<< "server test Post"<<endl;
      res.status=200;
  });
  svr.Get("./test-Get",[](const Request& req ,Response& res){
      cout<< "server test Get"<<endl;
      res.status=200;
  });

  svr.listen(IP.c_str(),PORT);
  cout<<"sucess"<<endl;
}

3. 約定雙端交互接?

定制http協(xié)議

新增?個(gè)聯(lián)系?:

[請(qǐng)求]
	Post /contacts/add 
	Content-Type: application/protobuf
	AddContactRequest
[響應(yīng)]
	Content-Type: application/protobuf
	AddContactResponse

刪除?個(gè)聯(lián)系?:

[請(qǐng)求]
	Post /contacts/del 
	Content-Type: application/protobuf
	DelContactRequest
[響應(yīng)]
	Content-Type: application/protobuf
	DelContactResponse

查詢通訊錄列表:

[請(qǐng)求]
	GET /contacts/find-all
[響應(yīng)]
	Content-Type: application/protobuf
	FindAllContactsResponse

查詢?個(gè)聯(lián)系?的詳細(xì)信息:

[請(qǐng)求]
	Post /contacts/find-one 
	Content-Type: application/protobuf
	FindOneContactRequest
[響應(yīng)]
	Content-Type: application/protobuf
	FindOneContactResponse

4. 代碼實(shí)現(xiàn)客戶端

這里我們只實(shí)現(xiàn)了新增?個(gè)聯(lián)系?模塊,完整代碼在碼云.

add_contact.proto

syntax="proto3";
package add_contact;

message AddContactReq{
  string name = 1 ;
  int32 age = 2 ;
  message Phone{
    string number = 1;
    enum PhoneType{
      MP=0;
      TEL=1;
    }
    PhoneType type =2;
  }
  repeated Phone phones = 3;
}

message AddContactResp{
  bool success = 1; // 添加聯(lián)系人是否成功
  string error_desc =2 ;// 錯(cuò)誤信息
  string uid =3 ; // 聯(lián)系人序號(hào)
}

ContactException.h:定義異常類

#include<string>
class ContactException
{
  private:
  std::string message;

  public:
  ContactException(std::string str="A problem"):message(str){}

  std::string what()const {return message; }
};

main.cc

#include "httplib.h"
#include "contactException.h"
#include "add_contact.pb.h"
#include <iostream>
#include <string>
using namespace std;
using namespace httplib;

const string IP = "127.0.0.1"; // 監(jiān)聽(tīng)所有的ip
// const string IP = "192.139.99.192";
const int PORT = 6666;
void menu();
void addContact();
void buildAddContactReq(add_contact::AddContactReq *req);
int main()
{
  while (true)
  {
    enum OPTION{QUIT = 0,ADD,DEL,FIND_ALL,FIND_ONE};

    menu();
    cout << "--------請(qǐng)選擇:";
    int choose;
    cin >> choose;
    cin.ignore(256, '\n');
    try
    {
      switch (choose)
      {
      case ADD:
        addContact();
        break;
      case DEL:
        break;
      case FIND_ALL:
        break;
      case FIND_ONE:
        break;
      case QUIT:
        cout << "程序退出" << endl;
        exit(0);
        break;
      default:
        break;
      }
    }
    catch (ContactException &e)
    {
      cout << "--->操作通訊錄時(shí)發(fā)生異常" << endl
           << "--->異常信息:" << e.what() << endl;
    }
  }
}
void addContact()
{
  Client client(IP, PORT);
  //構(gòu)造 req
  add_contact::AddContactReq req;
  buildAddContactReq(&req);

  // 序列化 req
  string req_str;
  if (!req.SerializePartialToString(&req_str))
  {
    throw ContactException("req 序列化失敗");
  }

  // 發(fā)起post調(diào)用
  auto ret = client.Post("/contacts/add", req_str, "Content-Type: application/protobuf");
  if (!ret)
  {
    string err_desc;
    err_desc.append("Post /contacts/add 請(qǐng)求失敗! 錯(cuò)誤信息:")
        .append(/*httplib::to_string(ret.error())當(dāng)前httplib沒(méi)有該函數(shù)*/
                to_string(ret.error()));
    throw ContactException(err_desc);
  }
  // 方序列號(hào)resp
  add_contact::AddContactResp resp;
  bool parse = resp.ParseFromString(ret->body);
  if(!parse){
   throw ContactException("反序列化失敗!");
  }
  if (ret->status != 200 && !parse)
  {
    string err_desc;
    err_desc.append("/contacts/add 調(diào)用失敗")
        .append(std::to_string(ret->status))
        .append("(")
        .append(ret->reason)
        .append(")")
        .append(resp.error_desc());
    throw ContactException(err_desc);
  }
  else if (ret->status != 200)
  {
    string err_desc;
    err_desc.append("/contacts/add 調(diào)用失敗")
        .append(std::to_string(ret->status))
        .append("(")
        .append(ret->reason)
        .append(")")
        .append("錯(cuò)誤信息:")
        .append(resp.error_desc());

    throw ContactException(err_desc);
  }
  else if (!resp.success())
  {
    string err_desc;
    err_desc.append("/contacts/add 結(jié)果異常\t異常原因")
        .append(std::to_string(ret->status))
        .append("(")
        .append(resp.error_desc())
        .append(")");
    throw ContactException(err_desc);
  }

  // 結(jié)果打印

  cout<<"新添加的聯(lián)系人"<<resp.uid()<<"成功"<<endl;

}

void buildAddContactReq(add_contact::AddContactReq* req)
{
  cout << "請(qǐng)輸入姓名:";
  string name;
  getline(std::cin,name);
  cout << "請(qǐng)輸入年齡:";
  int age;
  cin >> age;
  cin.ignore(256, '\n');
  int i = 1;
  req->set_age(age);
  req->set_name(name);
  while (true)
  {
    cout << "請(qǐng)輸入手機(jī)號(hào)碼" << i++ << ":";
    string number;
     getline(std::cin,number);
    if (number.empty())
    {
      //cout << "輸入聯(lián)系人完成\n";
      break;
    }
    add_contact::AddContactReq_Phone *phone = req->add_phones();
    phone->set_number(number);
    cout << "請(qǐng)輸入手機(jī)類型(ML:0,TEL:1):";
    int type;
    cin >> type;
    cin.ignore(256, '\n');
    phone->set_type((add_contact::AddContactReq_Phone_PhoneType)type);
  }
}
void menu()
{
  std::cout << "-----------------------------------------------------" << std::endl
            << "--------------- 請(qǐng)選擇對(duì)通訊錄的操作 ----------------" << std::endl
            << "------------------ 1、新增聯(lián)系? --------------------" << std::endl
            << "------------------ 2、刪除聯(lián)系? --------------------" << std::endl
            << "------------------ 3、查看聯(lián)系?列表 ----------------" << std::endl
            << "------------------ 4、查看聯(lián)系?詳細(xì)信息 ------------" << std::endl
            << "------------------ 0、退出 --------------------------" << std::endl
            << "-----------------------------------------------------" << std::endl;
}

5. 代碼實(shí)現(xiàn)服務(wù)端

add_contact.proto

syntax="proto3";
package add_contact;

message AddContactReq{
  string name = 1 ;
  int32 age = 2 ;
  message Phone{
    string number = 1;
    enum PhoneType{
      MP=0;
      TEL=1;
    }
    PhoneType type =2;
  }
  repeated Phone phone = 3;
}

message AddContactResp{
  bool success = 1; // 添加聯(lián)系人是否成功
  string error_desc =2 ;// 錯(cuò)誤信息
  string uid =3 ; // 聯(lián)系人唯一序號(hào)
}

utils.h 工具類


#include <iostream>
#include <sstream>
#include <random>

namespace Contact_Utils
{
  class Utils
{
public:

	/// 生成一個(gè)唯一標(biāo)識(shí)符,用于賦值uid
  static std::string generateUUID(size_t len)
  {
    // 使用隨機(jī)數(shù)生成器生成隨機(jī)數(shù)種子
    std::random_device device;
    std::mt19937 generator(device());

    // 使用16進(jìn)制表示的48位的隨機(jī)數(shù)

    // std::hex是C++中的一個(gè)std::ios_base標(biāo)志,用于指定輸出流以十六進(jìn)制形式輸出整數(shù)。當(dāng)使用該標(biāo)志時(shí),輸出流中的整數(shù)將以十六進(jìn)制表示。例如,當(dāng)輸出整數(shù)0x123時(shí),使用std::hex標(biāo)志會(huì)將其輸出為字符串"123",而不是"291"。在上述示例代碼中,std::hex被用于指定std::ostringstream以十六進(jìn)制形式輸出整數(shù),從而生成16進(jìn)制表示的48位唯一標(biāo)識(shí)符。
    std::ostringstream uuid;
    uuid << std::hex;
    for (size_t i = 0; i < len; ++i)
    {
      uuid << (generator() & 0xf);
    }

    return uuid.str();
  }
};
}

main.cc文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-518101.html

#include "httplib.h"
#include "add_contact.pb.h"
#include "contactException.h"
#include <iostream>
#include <string>
#include"utils.h"
using namespace std;
using namespace httplib;
const string IP = "127.0.0.1";

// const string IP = "0.0.0.0";
// const string IP = "192.139.99.192";

const int PORT = 6666;

void printContact(add_contact::AddContactReq &request);
int main()
{
  // 接收請(qǐng)求
  Server svr;

  // 處理請(qǐng)求
  // 注冊(cè)post的回調(diào)函數(shù)
  svr.Post("/contacts/add", [](const Request &req, Response &resp)
           {
            cout<<"收到Post請(qǐng)求!"<<endl;
            add_contact::AddContactResp response;
            add_contact::AddContactReq  request;
             try
             {
              if(!request.ParseFromString(req.body)){
                throw ContactException("方序序列化失敗!");
              }
              // 持久化聯(lián)系人
              printContact(request);

              // 構(gòu)造 response : res.body
              response.set_success(true);
              response.set_uid(Contact_Utils::Utils::generateUUID(12));
              // 序列化 response
              string response_str;
              if(!response.SerializePartialToString(&response_str))
              {
                throw ContactException("序列化失敗!");
              }

              resp.status=200;
              resp.body=response_str;
              resp.set_header("Content-Type","application/protobuf");

             }
             catch (ContactException &e)
             {
                  resp.status=500;
                  response.set_success(false);
                  response.set_error_desc(e.what());
                  string response_str;
                  if(response.SerializePartialToString(&response_str)){
                    resp.body=response_str;
                    resp.set_header("Content-Type","application/protobuf");
                  }
                  cout<<"/contacts/add 發(fā)生異常,異常信息:"<<e.what()<<endl;
             } });
  // 生成resp,

  // 并發(fā)送resp,

  svr.listen(IP.c_str(), PORT);
}

void printContact(add_contact::AddContactReq &req)
{
  cout << "添加聯(lián)系人成功\n-->姓名:" << req.name() << "-->年齡:" << req.age() << endl;
  cout << "-----電話號(hào)碼-------" << endl;
  for (int i = 0; i < req.phone_size(); i++)
  {
    
    cout << "電話" << i << ":" << req.phone(i).number() << "(type:" <<req.phone(i).PhoneType_Name(req.phone(i).type())<< ")" << endl;
  }
}

到了這里,關(guān)于網(wǎng)絡(luò)通訊錄服務(wù)器的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 【C語(yǔ)言】動(dòng)態(tài)內(nèi)存管理基礎(chǔ)知識(shí)——?jiǎng)討B(tài)通訊錄,如何實(shí)現(xiàn)通訊錄容量的動(dòng)態(tài)化

    【C語(yǔ)言】動(dòng)態(tài)內(nèi)存管理基礎(chǔ)知識(shí)——?jiǎng)討B(tài)通訊錄,如何實(shí)現(xiàn)通訊錄容量的動(dòng)態(tài)化

    動(dòng)態(tài)內(nèi)存管理的函數(shù)有:malloc,calloc,ralloc,free,本文講解動(dòng)態(tài)內(nèi)存函數(shù)和使用,如何進(jìn)行動(dòng)態(tài)內(nèi)存管理,實(shí)現(xiàn)通訊錄聯(lián)系人容量的動(dòng)態(tài)化,對(duì)常見(jiàn)動(dòng)態(tài)內(nèi)存錯(cuò)誤進(jìn)行總結(jié)。 ???????? ? ? ? ? ? ? ? ? ??? 豬巴戒 :個(gè)人主頁(yè)? ??????????????? 所屬專欄 :《C語(yǔ)言進(jìn)階》

    2024年02月04日
    瀏覽(44)
  • C語(yǔ)言—通訊錄

    C語(yǔ)言—通訊錄

    通訊錄中是存放人的信息的,人的信息包括:姓名、年齡、性別、電話、住址??梢园讶说男畔⒍x成結(jié)構(gòu)體,因?yàn)槊總€(gè)聯(lián)系人的信息都有這幾個(gè)要素。 注:用#define定義的標(biāo)識(shí)符常量,使用修改時(shí)可以降低維護(hù)成本。如聯(lián)系人的信息中名字的寬度為20,以便之后需要修改時(shí)只

    2024年02月05日
    瀏覽(88)
  • 【通訊錄】--C語(yǔ)言

    【通訊錄】--C語(yǔ)言

    ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???? ?? ?? ?? 個(gè)人主頁(yè) :阿然成長(zhǎng)日記 ??點(diǎn)擊可跳轉(zhuǎn) ?? 個(gè)人專欄: ??數(shù)據(jù)結(jié)構(gòu)與算法??C語(yǔ)言進(jìn)階 ?? 不能則學(xué),不知?jiǎng)t問(wèn),恥于問(wèn)人,決無(wú)長(zhǎng)進(jìn) ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 用c語(yǔ)言實(shí)現(xiàn)一個(gè)通訊

    2024年02月15日
    瀏覽(99)
  • 【C語(yǔ)言】通訊錄

    【C語(yǔ)言】通訊錄

    目錄 一、關(guān)于通訊錄 二、代碼邏輯 三、通訊錄實(shí)現(xiàn) 1.菜單設(shè)計(jì) 2.邏輯主要功能設(shè)計(jì) 3.增加聯(lián)系人功能實(shí)現(xiàn) 4.顯示全部聯(lián)系人信息? ?5.刪除聯(lián)系人 6.查找聯(lián)系人 7.修改聯(lián)系人信息 8.對(duì)聯(lián)系人進(jìn)行排序 ?9.一鍵清空所有聯(lián)系人 四、完整源碼 test.c contact.c contact.h 在通訊錄中,我

    2024年02月08日
    瀏覽(92)
  • C語(yǔ)言通訊錄

    C語(yǔ)言通訊錄

    ????????在本博客中,我們將介紹如何使用C語(yǔ)言構(gòu)建一個(gè)基本的通訊錄。主要涉及C語(yǔ)言的指針、結(jié)構(gòu)體、動(dòng)態(tài)內(nèi)存管理、文件操作等方面的知識(shí)。我們還將學(xué)習(xí)如何使用C語(yǔ)言的各種功能和技巧來(lái)實(shí)現(xiàn)通訊錄的各種操作,如添加聯(lián)系人、編輯聯(lián)系人、刪除聯(lián)系人和搜索聯(lián)系

    2024年02月16日
    瀏覽(89)
  • C語(yǔ)言——通訊錄

    C語(yǔ)言——通訊錄

    相信大家都有過(guò)通訊錄,今天我來(lái)帶大家實(shí)現(xiàn)以下最簡(jiǎn)單的通訊錄,通過(guò)本篇文章,相信可以讓大家對(duì)C語(yǔ)言有進(jìn)一步的認(rèn)識(shí)。 話不多說(shuō),我們先放函數(shù)的實(shí)現(xiàn) ?是不是看到這里會(huì)感到很害怕??不用怕,跟著我的思路,你也可以實(shí)現(xiàn)它,我?guī)е阋徊揭徊綄?shí)現(xiàn)每一個(gè)功能 ?

    2024年02月13日
    瀏覽(96)
  • C++ 通訊錄案例

    代碼如下:

    2024年02月13日
    瀏覽(96)
  • python-手機(jī)通訊錄

    手機(jī)通訊錄 通訊錄是記錄了聯(lián)系人姓名和聯(lián)系方式的名錄,手機(jī)通訊錄是最常見(jiàn)的通訊錄之一,人們可以在通訊錄中通過(guò)姓名查看相關(guān)聯(lián)系人的聯(lián)系方式等信息,也可以在其中新增聯(lián)系人,或修改、刪除聯(lián)系人信息。 本實(shí)例要求編寫程序,實(shí)現(xiàn)具備添加、查看、修改以及刪

    2024年02月06日
    瀏覽(93)
  • 手機(jī)通訊錄 python

    person_info = [] print(“=” * 20) print(‘歡迎使用通訊錄:’) print(“1.添加聯(lián)系人”) print(“2.查看通訊錄”) print(“3.刪除聯(lián)系人”) print(“4.修改聯(lián)系人信息”) print(“5.查找聯(lián)系人”) print(“6.退出”) print(“=” * 20) while True: per_dict = {} fun_num = input(‘請(qǐng)輸入功能序號(hào):’) if fun_num

    2024年02月06日
    瀏覽(28)
  • Java實(shí)現(xiàn)通訊錄

    Java實(shí)現(xiàn)通訊錄

    前言:通訊錄非常適合前期需要練習(xí)語(yǔ)法的小伙伴,效果非常好。 水再渾濁,只要長(zhǎng)久沉淀,依然會(huì)分外清澈。 人再愚鈍,只要足夠努力,一樣能改寫命運(yùn)。 此通訊錄的功能包括: 1.刪除聯(lián)系人 2.增加聯(lián)系人 3.展示已有聯(lián)系人 4.查找聯(lián)系人 5.排序聯(lián)系人 6.退出通訊錄 聯(lián)系人

    2024年02月11日
    瀏覽(29)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包