1、#include #include #include #include struct CLIENTchar sName10;char sPsw10;struct CLIENT *pNext;struct CLIENT *pFront;struct CLIENT*Push(struct CLIENT*pHead)int iSResult=0;struct CLIENT uTemp=0;struct CLIENT* pUser=NULL;printf(“tttt 请输入账号:ntttt“);scanf(“%s“,printf(“tttt 请输入密码:ntttt“);scanf(“%s“,if(pH
2、ead=NULL)pUser=(struct CLIENT*)malloc(sizeof(struct CLIENT);*pUser=uTemp;pUser-pFront=pUser;pUser-pNext=pUser;pHead=pUser;printf(“tttt 入栈成功n“);return pHead;pUser=(struct CLIENT*)malloc(sizeof(struct CLIENT);*pUser=uTemp;pUser-pFront=pUser;pUser-pNext=pUser;pHead-pFront-pNext=pUser;pUser-pNext=pHead;
3、pUser-pFront=pHead-pFront;pHead-pFront=pUser;printf(“tttt 入栈成功n“);return pHead;struct CLIENT*Pop(struct CLIENT*pHead)if (pHead!=0)struct CLIENT * pUser = NULL;pUser = pHead-pFront;pUser-pFront-pNext = pHead;pHead-pFront = pUser-pFront;free(pUser);printf(“tttt 出栈成功n“);return pHead;printf(“tttt 栈为空n“)
4、;void Egodic(struct CLIENT*pHead)struct CLIENT * pUser = pHead;if(pHead=0)printf(“tttt 栈为空n“);return;while(1)printf(“tttt%st%sn“, pUser-sName, pUser-sPsw);if(pHead-pNext=pUser)return;pUser=pUser-pNext;void Search(struct CLIENT*pHead,char *cName)struct CLIENT * pUser = pHead;if(pHead=0)printf(“tttt 栈
5、为空n“);return;while(1)if(strcmp(pUser-sName,cName)=0)printf(“tttt%st%sn“, pUser-sName, pUser-sPsw);if (pHead-pNext = pUser)return;pUser =pUser-pNext;void Menu()printf(“tttt1.入 栈n“);printf(“tttt2.出 栈n“);printf(“tttt3.遍 历n“);printf(“tttt4.查 询n“);printf(“tttt0. 退 出 n“);void main()Menu();struct CLIENT *
6、pHead = NULL;int iSw=0;int iScanfResult=0;while (1)while (1)printf(“tttt-选择 :“);iScanfResult = scanf(“%d“, if (iScanfResult 0) break;elseprintf(“请输入正确的数字!n“);fflush(stdin);switch (iSw)case 0:system(“CLS“);exit(0);case 1:system(“CLS“);Menu();pHead = Push(pHead);break;case 2:system(“CLS“);Menu();pHead = Pop(pHead);break;case 3:system(“CLS“);Menu();Egodic(pHead);break;case 4:system(“CLS“);Menu();printf(“tttt 输入要查询 ID:ntttt“);char sName10 = 0;scanf(“%s“, sName);Search(pHead, sName);break;