为什么输入1弹不出“用户指令--->>新建联系人:“,求各位大神解答,谢谢啦
#include<stdlib.h>
#include"List.h"
#include<iostream>
using namespace std;
void createPerson(List *pList)
{
Node node;
Person person;
cout<<"请输入姓名:";
cin>>person.name;
cout<<"请输入电话:";
cin>>person.phone;
node.data=person;
pList->ListInsertTail(&node);
}
int menu()
{
//显示通讯录功能菜单
cout<<"功能菜单"<<endl;
cout<<"1.新建联系人"<<endl;
cout<<"2.删除联系人"<<endl;
cout<<"3.浏览通讯录"<<endl;
cout<<"4.退出通讯录"<<endl;
cout<<"请输入:";
int order=0;
cin>>order;
return order;
}
int main(void){
int userOrder=0;
List *pList=new List();
while(userOrder!=4)
{
userOrder=menu();
switch(userOrder)
{
case1:
cout<<"用户指令--->>新建联系人:"<<endl;
createPerson(pList);
break;
case2:
cout<<"用户指令--->>删除联系人:"<<endl;
break;
case3:
cout<<"用户指令--->>浏览通讯录:"<<endl;
pList->ListTraverse();
break;
case4:
cout<<"用户指令--->>退出通讯录:"<<endl;
break;
default:
break;
}
}
delete pList;
pList=NULL;
}