⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 主要实现人员管理功能
💻 CPP
字号:
#include"Leidingyi.h"
#include<iostream>
#include<string>

#include<windows.h>
using namespace std;

int main()
{
	cout<<"Welcome to the program of person manage test."<<endl;
	cout<<"1.Display all"<<endl;
	cout<<"2.Search Name"<<endl;
	cout<<"3.Search No."<<endl;
	cout<<"4.Add person"<<endl;
	cout<<"5.Delete by Name"<<endl;
	cout<<"6.Delete by No."<<endl;
	cout<<"7.Exit"<<endl;
	cout<<"Please select one function:"<<endl;

	int choice;	
	cin>>choice;

Node zzh;
 Person p;
    
    Node *head=new Node(zzh);
	head->No=0;	
	for(int i=0;i<22;i++)
	{
		head->NName[i]=0;
	
	}
	head->next=NULL;
	
	while(choice!=7)
	{
		char aname[22]={0};
		int ano;

		switch(choice)
		{
		case 1:
			cout<<"Here are all nodes:"<<endl;
			p.ShowAllNode(head);
			break;
		case 2:
			cout<<"Input Name:";
			cin>>aname;
			p.SearchName(head,aname);
			break;
		case 3:
			cout<<"Input No.:";
			cin>>ano;
			p.SearchNo(head,ano);
			break;
		case 4:
			p.AddNode(head);
			break;
		case 5:
			cout<<"Input a person's name to be deleted:";
			cin>>aname;
			p.DeleteName(head,aname);
			break;
		case 6:
			cout<<"Input a person's No. to be deleted:";
			cin>>ano;
			p.DeleteNo(head,ano);
			break;
		default:
			cout<<"Wrong input!"<<endl;
			cout<<"Please wait for 3 second!"<<endl;
			Sleep(3000);
			break;

		}
		cout<<endl<<endl<<endl;
		cout<<"Welcome to the program of person manage test."<<endl;
    	cout<<"1.Display all"<<endl;
	    cout<<"2.Search Name"<<endl;
    	cout<<"3.Search No."<<endl;
    	cout<<"4.Add person"<<endl;
	    cout<<"5.Delete by Name"<<endl;
    	cout<<"6.Delete by No."<<endl;
    	cout<<"7.Exit"<<endl;
    	cout<<"Please select one function:"<<endl;
    	cin>>choice;
	}
	cout<<"Bye!"<<endl;
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -