欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C++實現(xiàn)智能柜管理系統(tǒng)

 更新時間:2022年03月24日 16:52:16   作者:T2020_2_22  
這篇文章主要為大家詳細介紹了C++實現(xiàn)智能柜管理系統(tǒng),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了C++實現(xiàn)智能柜管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;

struct Node
{
?? ?int pcode;
?? ?int num;
?? ?string pnum;
?? ?time_t tnum;
?? ?Node *next;
?? ?Node *prev;
};

//取件成功+剩余提示
void rreaction(int l) {
?? ?cout << "______________________________________________________________";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?取件成功?。?!";
?? ?cout << endl;
?? ?cout << "______________________________________________________________";
?? ?cout << endl;
?? ?system("pause");
?? ?system("cls");
?? ?if (l != 0) {
?? ??? ?cout << "______________________________________________________________";
?? ??? ?cout << endl;
?? ??? ?cout << endl;
?? ??? ?cout << " ? ? ? ? ? ? ?當前手機號還有"<< l <<"件未?。。?!";
?? ??? ?cout << endl;
?? ??? ?cout << "______________________________________________________________";
?? ??? ?cout << endl;
?? ??? ?system("pause");
?? ??? ?system("cls");
?? ?}
}

//取件碼錯誤
void freaction() {
?? ?cout << "______________________________________________________________";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?取件碼錯誤?。?!";
?? ?cout << endl;
?? ?cout << "______________________________________________________________";
?? ?cout << endl;
?? ?system("pause");
?? ?system("cls");
}

//取件系統(tǒng)
int pcode() {
?? ?int j = 0;
?? ?int l = 0;
?? ?int list1[25];
?? ?int list2[25];
?? ?string list3[25];
?? ?int list4[25];
?? ?ifstream file1("num.txt");
?? ?ifstream file2("tnum.txt");
?? ?ifstream file3("pnum.txt");
?? ?ifstream file4("pcode.txt");
?? ?while (file1.peek() != EOF) {
?? ??? ?file1 >> list1[j];
?? ??? ?file2 >> list2[j];
?? ??? ?file3 >> list3[j];
?? ??? ?file4 >> list4[j++];
?? ?}
?? ?
?? ?file1.close();
?? ?file2.close();
?? ?file3.close();
?? ?file4.close();

?? ?int pcode;
?? ?cout << "______________________________________________________________";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?取件碼:"; cin >> pcode;
?? ?cout << endl;
?? ?cout << "______________________________________________________________";
?? ?
?? ?for (int i = 0; i < j-1; i++) {
?? ??? ?if (list4[i] == pcode) {?
?? ??? ??? ?ofstream file1;
?? ??? ??? ?file1.open("num.txt");
?? ??? ??? ?ofstream file2;
?? ??? ??? ?file2.open("tnum.txt");
?? ??? ??? ?ofstream file3;
?? ??? ??? ?file3.open("pnum.txt");
?? ??? ??? ?ofstream file4;
?? ??? ??? ?file4.open("pcode.txt");
?? ??? ??? ?for (int k = 0; k < j-1; k++) {
?? ??? ??? ??? ?if (k == i)continue;
?? ??? ??? ??? ?else {
?? ??? ??? ??? ??? ?if (list3[i] == list3[k])l = l + 1;
?? ??? ??? ??? ??? ?file1 << list1[k] << endl;
?? ??? ??? ??? ??? ?file2 << list2[k] << endl;
?? ??? ??? ??? ??? ?file3 << list3[k] << endl;
?? ??? ??? ??? ??? ?file4 << list4[k] << endl;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?file1.close();
?? ??? ??? ?file2.close();
?? ??? ??? ?file3.close();
?? ??? ??? ?file4.close();

?? ??? ??? ?system("cls");?
?? ??? ??? ?cout << "______________________________________________________________";
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?柜號"<<list1[i]<<"已打開";
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << "______________________________________________________________";
?? ??? ??? ?cout << endl;
?? ??? ??? ?system("pause");
?? ??? ??? ?system("cls");
?? ??? ??? ?return l;?
?? ??? ?}
?? ?}
?? ?system("cls");?
?? ?return -1;
}

//快遞員取件
Node* dnode(Node* head,int n) {
?? ?Node *p0;
?? ?p0 = head;
?? ?while (p0->prev != NULL) {
?? ??? ?if (p0->num == n) {
?? ??? ??? ?if (p0 == head) {
?? ??? ??? ??? ?head = head->prev;
?? ??? ??? ??? ?delete p0;
?? ??? ??? ??? ?return head;
?? ??? ??? ?}
?? ??? ??? ?else {
?? ??? ??? ??? ?p0->prev->next = p0->next;
?? ??? ??? ??? ?p0->next->prev = p0->prev;
?? ??? ??? ??? ?delete p0;
?? ??? ??? ??? ?return head;
?? ??? ??? ?}
?? ??? ?}
?? ??? ?p0 = p0->prev;
?? ??? ?if (p0->prev == NULL)
?? ??? ?{?? ?
?? ??? ??? ?cout << "______________________________________________________________";
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << " ? ? ? ? ? ? ? ? ? ? ? 柜號" << n << "為空!!!";
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << "______________________________________________________________";
?? ??? ??? ?cout << endl;
?? ??? ??? ?system("pause");
?? ??? ??? ?system("cls");
?? ??? ??? ?return head;
?? ??? ?}
?? ?}
?? ?return head;
}

//柜子界面
int ginformation(Node* head) {
?? ?Node *p0;
?? ?p0 = head;
?? ?int j = 1;
?? ?int n;
?? ?int m[26] = { 0 };
?? ?while (p0->prev != NULL) {
?? ??? ?m[p0->num] = 1;
?? ??? ?p0 = p0->prev;
?? ?}
?? ?cout << "_________________________________________________________________________________________________________________________" << endl;
?? ?cout << "| ? ? ? ? ? 1 ? ? ? ? ? | ? ? ? ? ? 2 ? ? ? ? ? | ? ? ? ? ? 3 ? ? ? ? ? | ? ? ? ? ? 4 ? ? ? ? ? | ? ? ? ? ? 5 ? ? ? ? ? |" << endl;
?? ?cout << "| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?|" << endl;
?? ?cout << "|_______________________|_______________________|_______________________|_______________________|_______________________|" << endl;
?? ?cout << "| ? ? ? ? ? 6 ? ? ? ? ? | ? ? ? ? ? 7 ? ? ? ? ? | ? ? ? ? ? 8 ? ? ? ? ? | ? ? ? ? ? 9 ? ? ? ? ? | ? ? ? ? ? 10 ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?|" << endl;
?? ?cout << "|_______________________|_______________________|_______________________|_______________________|_______________________|" << endl;
?? ?cout << "| ? ? ? ? ? 11 ? ? ? ? ?| ? ? ? ? ? 12 ? ? ? ? ?| ? ? ? ? ? 13 ? ? ? ? ?| ? ? ? ? ? 14 ? ? ? ? ?| ? ? ? ? ? 15 ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "|_______________________|_______________________|_______________________|_______________________|_______________________|" << endl;
?? ?cout << "| ? ? ? ? ? 16 ? ? ? ? ?| ? ? ? ? ? 17 ? ? ? ? ?| ? ? ? ? ? 18 ? ? ? ? ?| ? ? ? ? ? 19 ? ? ? ? ?| ? ? ? ? ? 20 ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "|_______________________|_______________________|_______________________|_______________________|_______________________|" << endl;
?? ?cout << "| ? ? ? ? ? 21 ? ? ? ? ?| ? ? ? ? ? 22 ? ? ? ? ?| ? ? ? ? ? 23 ? ? ? ? ?| ? ? ? ? ? 24 ? ? ? ? ?| ? ? ? ? ? 25 ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?| ? ? ? ? "; if (m[j] == 0) { j++; cout << " --- ?"; }
?? ?else { j++; cout << "已存放"; } cout << " ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? ? ? ? ? ? |" << endl;
?? ?cout << "|_______________________|_______________________|_______________________|_______________________|_______________________|" << endl;
?? ?cout << endl << " ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?輸入要取出的智能柜的編號(輸入'0'返回):";
?? ?cin >> n;
?? ?switch (n) {
?? ?case 1:
?? ?case 2:
?? ?case 3:
?? ?case 4:
?? ?case 5:
?? ?case 6:
?? ?case 7:
?? ?case 8:
?? ?case 9:
?? ?case 10:
?? ?case 11:
?? ?case 12:
?? ?case 13:
?? ?case 14:
?? ?case 15:
?? ?case 16:
?? ?case 17:
?? ?case 18:
?? ?case 19:
?? ?case 20:
?? ?case 21:
?? ?case 22:
?? ?case 23:
?? ?case 24:
?? ?case 25:
?? ??? ?system("cls");
?? ??? ?return n;
?? ?case 0:
?? ??? ?system("cls");
?? ??? ?return n;
?? ?default:
?? ??? ?system("cls");
?? ??? ?return -1;
?? ?}
}

//初始化
Node* init()
{
?? ?Node *head;
?? ?head = new Node;
?? ?head->next = NULL;
?? ?head->prev = NULL;
?? ?return head;
}
Node* autoinput(Node* head) {
?? ?int j = 0;
?? ?int list1[25];
?? ?int list2[25];
?? ?string list3[25];
?? ?int list4[25];
?? ?ifstream file1("num.txt");
?? ?ifstream file2("tnum.txt");
?? ?ifstream file3("pnum.txt");
?? ?ifstream file4("pcode.txt");
?? ?while (file1.peek() != EOF) {
?? ??? ??? ?file1 >> list1[j];?? ??? ?
?? ??? ??? ?file2 >> list2[j];?? ??? ??? ??? ??? ??? ?
?? ??? ??? ?file3 >> list3[j];?? ??? ?
?? ??? ??? ?file4 >> list4[j++];
?? ?}

?? ?file1.close();
?? ?file2.close();
?? ?file3.close();
?? ?file4.close();

?? ?for (int i = 0; i < j-1; i++) {
?? ??? ?Node *p0, *p1;
?? ??? ?p0 = head;
?? ??? ?p1 = new Node;
?? ??? ?p1->num = list1[i];
?? ??? ?p1->tnum = list2[i];
?? ??? ?p1->pnum = list3[i];
?? ??? ?p1->pcode = list4[i];?? ?
?? ??? ?p1->prev = p0;
?? ??? ?p0->next = p1;
?? ??? ?p1->next = NULL;
?? ??? ?head = p1;
?? ?}
?? ?return head;
}

//柜滿警告
void serror(Node* head) {
?? ?system("cls");
?? ?cout << "____________________________________________________________________________________";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?無可用的柜子?。?!";
?? ?cout << endl;
?? ?cout << "____________________________________________________________________________________";
?? ?cout << endl;
?? ?system("pause");
?? ?system("cls");
}

//派送快遞
int sedelivery(Node* head) {
?? ?int list[25];
?? ?int i = 0;
?? ?int k = 0;
?? ?Node *p0,*p1,*p2;
?? ?p0 = head;
?? ?p2 = head;
?? ?p1 = new Node;
?? ?while (p2->prev != NULL) {
?? ??? ?list[i] = p2->num;
?? ??? ?p2 = p2->prev;
?? ??? ?i++;
?? ?}
?? ?string size,pnum;
?? ?unsigned seed;
?? ?time_t now = time(0);
?? ?seed = time(0);
?? ?srand(seed);
?? ?cout << "____________________________________________________________________________________";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?包裹大?。╯mall | medium | large):"; cin >> size;
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?手機號碼:"; cin >> pnum;
?? ?cout << endl;
?? ?cout << "____________________________________________________________________________________";
?? ?cout << endl;
?? ?if (pnum.length() != 11) {
?? ??? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?請輸入正確的手機號碼!?。?;
?? ??? ?cout << endl;
?? ??? ?system("pause");
?? ??? ?system("cls");
?? ??? ?return -1;
?? ?}
?? ?else p1->pnum = pnum;
?? ?if (size == "small") {
?? ??? ?int j = 1;
?? ??? ?for (; j <= 10; j++) {
?? ??? ??? ?for (; k <= i; k++) {
?? ??? ??? ??? ?if (k == i) {
?? ??? ??? ??? ??? ?p1->num = j;
?? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ?}
?? ??? ??? ??? ?if (j == list[k]) {
?? ??? ??? ??? ??? ?k = 0;
?? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?if (k != 0)break;
?? ??? ?}if (j == 11)return 0;
?? ?}
?? ?else if (size == "medium") {
?? ??? ?int j = 11;
?? ??? ?for (; j <= 20; j++) {
?? ??? ??? ?for (; k <= i; k++) {
?? ??? ??? ??? ?if (k == i) {
?? ??? ??? ??? ??? ?p1->num = j;
?? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ?}
?? ??? ??? ??? ?if (j == list[k]) {
?? ??? ??? ??? ??? ?k = 0;
?? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?if (k != 0)break;
?? ??? ?}if (j == 21)return 0;
?? ?}
?? ?else if (size == "large") {
?? ??? ?int j = 21;
?? ??? ?for (; j <= 25; j++) {
?? ??? ??? ?for (; k <= i; k++) {
?? ??? ??? ??? ?if (k == i) {
?? ??? ??? ??? ??? ?p1->num = j;
?? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ?}
?? ??? ??? ??? ?if (j == list[k]) {
?? ??? ??? ??? ??? ?k = 0;
?? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?if (k != 0)break;
?? ??? ?}if (j == 26)return 0;
?? ?}
?? ?else {
?? ??? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?請輸入正確的包裹大?。。?!";
?? ??? ?cout << endl;
?? ??? ?system("pause");
?? ??? ?system("cls");
?? ??? ?return -1;
?? ?}
?? ?p1->tnum = now;
?? ?p1->pcode = rand();
?? ?p1->prev = p0;
?? ?p0->next = p1;
?? ?p1->next = NULL;
?? ?head = p1;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ? ? ? 派送成功?。?!";
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ? ? 包裹將投放到" << p1->num << "號柜";
?? ?cout << endl;
?? ?system("pause");
?? ?system("cls");
?? ?return 1;
}

//超時快遞
int iexpress(Node* head) {
?? ?int n;
?? ?unsigned seed;
?? ?time_t now = time(0);
?? ?seed = time(0);
?? ?srand(seed);
?? ?Node *p0,*p1;
?? ?p0 = head;
?? ?while (p0->prev->prev != NULL)p0 = p0->prev;
?? ?p1 = p0;
?? ?while (p0 != NULL) {
?? ??? ?if (p0->tnum+86400 <= now) {
?? ??? ??? ?char* dt = ctime(&p0->tnum);
?? ??? ??? ?cout << "____________________________________________________________________________________";
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?柜號:" << p0->num << endl;
?? ??? ??? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?時間:" << dt << endl;
?? ??? ??? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?手機號碼:" << p0->pnum;
?? ??? ??? ?cout << endl;
?? ??? ??? ?cout << "____________________________________________________________________________________";
?? ??? ??? ?cout << endl;
?? ??? ?}
?? ??? ?else break;
?? ??? ?p0 = p0->next;
?? ?}
?? ?cout << endl << " ? ? ? ? ? ? ? ? ? ? 輸入要重放的智能柜的編號(輸入'0'返回):";
?? ?cin >> n;
?? ?if (n == 0);
?? ?else {
?? ??? ?while (p1 != NULL) {
?? ??? ??? ?if (p1->tnum + 86400 <= now) {
?? ??? ??? ??? ?if (p1->num == n) {
?? ??? ??? ??? ??? ?if (p1 == head) {
?? ??? ??? ??? ??? ??? ?p1->tnum = now;
?? ??? ??? ??? ??? ??? ?p1->pcode = rand();
?? ??? ??? ??? ??? ??? ?cout << endl << " ? ? ? ? ? ? ? ? ? ? ? ?操作成功!??!";
?? ??? ??? ??? ??? ??? ?cout << endl;
?? ??? ??? ??? ??? ??? ?cout << endl;
?? ??? ??? ??? ??? ??? ?system("pause");
?? ??? ??? ??? ??? ??? ?system("cls");
?? ??? ??? ??? ??? ??? ?return 1;
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?else {
?? ??? ??? ??? ??? ??? ?p1->prev->next = p1->next;
?? ??? ??? ??? ??? ??? ?p1->next->prev = p1->prev;
?? ??? ??? ??? ??? ??? ?p1->tnum = now;
?? ??? ??? ??? ??? ??? ?p1->pcode = rand();
?? ??? ??? ??? ??? ??? ?p1->prev = head;
?? ??? ??? ??? ??? ??? ?head->next = p1;
?? ??? ??? ??? ??? ??? ?p1->next = NULL;
?? ??? ??? ??? ??? ??? ?cout << endl << " ? ? ? ? ? ? ? ? ? ? ? ?操作成功!?。?;
?? ??? ??? ??? ??? ??? ?cout << endl;
?? ??? ??? ??? ??? ??? ?cout << endl;
?? ??? ??? ??? ??? ??? ?system("pause");
?? ??? ??? ??? ??? ??? ?system("cls");
?? ??? ??? ??? ??? ??? ?return 2;
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?else {
?? ??? ??? ??? ?cout << endl << " ? ? ? ? ? ? ? ? ? ? ? ?操作失?。。。?;
?? ??? ??? ??? ?cout << endl;
?? ??? ??? ??? ?cout << endl;
?? ??? ??? ??? ?system("pause");
?? ??? ??? ??? ?system("cls");
?? ??? ??? ??? ?return 1;
?? ??? ??? ?}
?? ??? ??? ?p1 = p1->next;
?? ??? ?}
?? ?}
?? ?system("cls");
?? ?return 1;
}

//文件輸出
void iinformation(Node* head) {
?? ?int j = 0;
?? ?Node *p0;
?? ?p0 = head;
?? ?int list1[25];
?? ?int list2[25];
?? ?string list3[25];
?? ?int list4[25];
?? ?while (p0->prev != NULL) {
?? ??? ?list1[j] = p0->num;
?? ??? ?list2[j] = p0->tnum;
?? ??? ?list3[j] = p0->pnum;
?? ??? ?list4[j++] = p0->pcode;
?? ??? ?p0 = p0->prev;
?? ?}
?? ?ofstream file1;
?? ?file1.open("num.txt");
?? ?ofstream file2;
?? ?file2.open("tnum.txt");
?? ?ofstream file3;
?? ?file3.open("pnum.txt");
?? ?ofstream file4;
?? ?file4.open("pcode.txt");
?? ?for (j = j - 1; j >= 0;) {
?? ??? ?file1 << list1[j] << endl;
?? ??? ?file2 << list2[j] << endl;
?? ??? ?file3 << list3[j] << endl;
?? ??? ?file4 << list4[j--] << endl;
?? ?}

?? ?file1.close();
?? ?file2.close();
?? ?file3.close();
?? ?file4.close();
}

//快遞員系統(tǒng)界面
int initialization(Node* head) {
?? ?int n;
?? ?cout << "____________________________________________________________________________________" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?智能柜管理系統(tǒng) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1.取出快遞 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2.放置快遞 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?3.查詢超時快遞 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0.注銷 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "|__________________________________________________________________________________|" << endl;
?? ?cout << endl << " ? ? ? ? ? ? ? ? ? ? ? ? ? ? 輸入對應(yīng)數(shù)字進入相應(yīng)功能:";
?? ?cin >> n;
?? ?switch (n) {
?? ?case 1:
?? ??? ?system("cls");
?? ??? ?return 1;
?? ?case 2:
?? ??? ?system("cls");
?? ??? ?return 2;
?? ?case 3:
?? ??? ?system("cls");
?? ??? ?return 3;
?? ?case 0:
?? ??? ?system("cls");
?? ??? ?return 0;
?? ?default:
?? ??? ?system("cls");
?? ??? ?return -1;
?? ?}
}

//登錄錯誤提示
void lerror() {
?? ?cout << "____________________________________________________________________________________";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?賬號或密碼錯誤?。?!";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << "____________________________________________________________________________________";
?? ?cout << endl;
?? ?system("pause");
?? ?system("cls");
}

//登錄系統(tǒng)
int lsystem() {
?? ?int j = 0;
?? ?int anumber;
?? ?int password;
?? ?int list1[10];
?? ?int list2[10];
?? ?ifstream file1("anumber.txt");
?? ?while (!file1.eof())
?? ??? ?file1 >> list1[j++];
?? ?
?? ?file1.close();

?? ?j = 0;
?? ?ifstream file2("password.txt");
?? ?while (!file2.eof())
?? ??? ?file2 >> list2[j++];

?? ?file2.close();

?? ?cout << "____________________________________________________________________________________";
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?賬號:"; cin >> anumber;
?? ?cout << endl;
?? ?cout << endl;
?? ?cout << " ? ? ? ? ? ? ? ? ? ? ? ?密碼:"; cin >> password;
?? ?cout << endl;
?? ?cout << "____________________________________________________________________________________";
?? ?for (int i = 0;i < j; i++) {
?? ??? ?if (list1[i] == anumber && list2[i] == password) {
?? ??? ??? ?system("cls");
?? ??? ??? ?return 1;
?? ??? ?}
?? ??? ?else {
?? ??? ??? ?system("cls");
?? ??? ??? ?return -1;
?? ??? ?}
?? ?}
?? ?return -1;
}

//系統(tǒng)界面
int linterface() {
?? ?int n;
?? ?cout << "____________________________________________________________________________________" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?智能柜管理系統(tǒng) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1.取快遞 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2.快遞員登錄 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0.退出 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|" << endl;
?? ?cout << "|__________________________________________________________________________________|" << endl;
?? ?cout << endl << " ? ? ? ? ? ? ? ? ? ? ? ? ? ?輸入對應(yīng)數(shù)字進入相應(yīng)功能:";
?? ?cin >> n;
?? ?switch (n) {
?? ?case 1:
?? ??? ?system("cls");
?? ??? ?return 1;
?? ?case 2:
?? ??? ?system("cls");
?? ??? ?return 2;
?? ?case 0:
?? ??? ?exit(1);
?? ?default:
?? ??? ?system("cls");
?? ??? ?return -1;
?? ?}
}

/*
?? ?n為系統(tǒng)界面返回值?? ??? ??? ??? ??? ?1為取件系統(tǒng)?? ??? ?2為快遞員登錄系統(tǒng)界面?? ?-1為循環(huán)
?? ?m為取件系統(tǒng)返回值?? ??? ??? ??? ??? ?-1為取件失敗?? ?其他為取件成功
?? ?j為登錄系統(tǒng)返回值?? ??? ??? ??? ??? ?1為登陸成功?? ??? ?-1為登錄失敗
?? ?k為快遞員系統(tǒng)界面返回值?? ??? ??? ??? ?1為柜子界面?? ??? ?2為派送快遞?? ??? ??? ??? ?3為超時快遞?? ??? ??? ?0為注銷
?? ?l為柜子界面返回值?? ??? ??? ??? ??? ?0為返回?? ??? ??? ?-1為循環(huán)?? ??? ??? ??? ?其他為快遞員取件
?? ?p為派送快遞返回值?? ??? ??? ??? ??? ?0為柜滿?? ??? ??? ?1為成功?? ??? ??? ??? ??? ?-1為返回
?? ?o為超時快遞返回值?? ??? ??? ??? ??? ?1為成功?? ??? ??? ?2為失敗
*/
int main() {
?? ?int n,m,j,k,l,p,o;
?? ?do {
?? ??? ?n = linterface();
?? ??? ?if (n == 1) {
?? ??? ??? ?m = pcode();
?? ??? ??? ?if (m == -1) {
?? ??? ??? ??? ?freaction();
?? ??? ??? ??? ?n = -1;
?? ??? ??? ?}
?? ??? ??? ?else {
?? ??? ??? ??? ?rreaction(m);
?? ??? ??? ??? ?n = -1;
?? ??? ??? ?}
?? ??? ?}
?? ??? ?else if (n == 2) {
?? ??? ??? ?j = lsystem();
?? ??? ??? ?if (j == 1) {
?? ??? ??? ??? ?Node *head;
?? ??? ??? ??? ?head = init();
?? ??? ??? ??? ?head = autoinput(head);
?? ??? ??? ??? ?do {
?? ??? ??? ??? ??? ?k = initialization(head);
?? ??? ??? ??? ??? ?if (k == 1) {
?? ??? ??? ??? ??? ??? ?do {
?? ??? ??? ??? ??? ??? ??? ?l = ginformation(head);
?? ??? ??? ??? ??? ??? ??? ?if (l > 0) {
?? ??? ??? ??? ??? ??? ??? ??? ?head = dnode(head, l);
?? ??? ??? ??? ??? ??? ??? ??? ?l = -1;
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?else if (l == 0) {
?? ??? ??? ??? ??? ??? ??? ??? ?k = -1;
?? ??? ??? ??? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?} while (l == -1);
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?else if (k == 2) {
?? ??? ??? ??? ??? ??? ?p = sedelivery(head);
?? ??? ??? ??? ??? ??? ?if (p == 0) {
?? ??? ??? ??? ??? ??? ??? ?serror(head);
?? ??? ??? ??? ??? ??? ??? ?k = -1;
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?else if (p == 1) {
?? ??? ??? ??? ??? ??? ??? ?head = head->next;
?? ??? ??? ??? ??? ??? ??? ?k = -1;
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?else if (p == -1) {
?? ??? ??? ??? ??? ??? ??? ?k = -1;
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?else if (k == 3) {
?? ??? ??? ??? ??? ??? ?o = iexpress(head);
?? ??? ??? ??? ??? ??? ?if(o == 2)head = head->next;
?? ??? ??? ??? ??? ??? ?k = -1;
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?else if (k == 0){
?? ??? ??? ??? ??? ??? ?iinformation(head);
?? ??? ??? ??? ??? ??? ?n = -1;
?? ??? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?else {
?? ??? ??? ??? ??? ??? ?k = -1;
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?} while (k == -1);
?? ??? ??? ?}
?? ??? ??? ?else {
?? ??? ??? ??? ?lerror();
?? ??? ??? ??? ?n = -1;
?? ??? ??? ?}
?? ??? ?}
?? ?} while (n == -1);
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • C語言模擬實現(xiàn)C++的繼承與多態(tài)示例

    C語言模擬實現(xiàn)C++的繼承與多態(tài)示例

    本篇文章主要介紹了C語言模擬實現(xiàn)C++的繼承與多態(tài)示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-05-05
  • linux之a(chǎn)wk命令的用法

    linux之a(chǎn)wk命令的用法

    awk是一個非常棒的數(shù)字處理工具。相比于sed常常作用于一整行的處理,awk則比較傾向于將一行分為數(shù)個“字段”來處理。運行效率高,而且代碼簡單,對格式化的文本處理能力超強
    2013-10-10
  • C++實現(xiàn)加減乘除計算器

    C++實現(xiàn)加減乘除計算器

    這篇文章主要為大家詳細介紹了C++實現(xiàn)加減乘除計算器,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下<BR>
    2022-01-01
  • C/C++?Qt?運用JSON解析庫的實例代碼

    C/C++?Qt?運用JSON解析庫的實例代碼

    這篇文章主要介紹了C/C++?Qt?運用JSON解析庫的相關(guān)知識,通過代碼依次解析這個json文件中的每一個參數(shù),代碼簡單易懂,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-01-01
  • c++類構(gòu)造函數(shù)詳解

    c++類構(gòu)造函數(shù)詳解

    這篇文章主要介紹了c++類構(gòu)造函數(shù)示例,需要的朋友可以參考下
    2014-05-05
  • 哈希表實驗C語言版實現(xiàn)

    哈希表實驗C語言版實現(xiàn)

    以下是對哈希表實驗用C語言實現(xiàn)的代碼進行了詳細的分析介紹,需要的朋友可以參考下
    2013-07-07
  • c++獲取進程信息列表和進程所調(diào)用的dll列表

    c++獲取進程信息列表和進程所調(diào)用的dll列表

    這篇文章主要介紹了c++獲取進程信息列表和進程所調(diào)用的dll列表,大家參考使用吧
    2013-11-11
  • Qt實現(xiàn)部件透明陰影效果與不規(guī)則窗體詳解

    Qt實現(xiàn)部件透明陰影效果與不規(guī)則窗體詳解

    這篇文章主要為大家詳細介紹了Qt實現(xiàn)部件透明陰影效果與不規(guī)則窗體的相關(guān)方法,文中的示例代碼講解詳細,感興趣的小伙伴可以了解一下
    2023-01-01
  • C++類與對象之日期類的實現(xiàn)

    C++類與對象之日期類的實現(xiàn)

    這篇文章主要介紹如何實現(xiàn)C++中的日期類相關(guān)資料,需要的朋友可以參考下面文章的具體內(nèi)容
    2021-09-09
  • C語言打印某一年中某月的日歷

    C語言打印某一年中某月的日歷

    本文詳細講解了C語言打印某一年中某月的日歷,文中通過示例代碼介紹的非常詳細。對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-12-12

最新評論