-
Notifications
You must be signed in to change notification settings - Fork 0
/
Orders_queue.h
130 lines (107 loc) · 2.89 KB
/
Orders_queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#pragma once
#include <iostream>
#include <string>
#include "Administrator.h"
using namespace std;
struct Orders
{
int cloth_ID;
int quantity;
string name;
string Address;
string Mobile_number;
string cardnum;
string cvv;
string holdername;
};
class OrdersQueue
{
private:
int front;
int rear;
int capacity;
int size;
Orders* data;
public:
OrdersQueue(int cap)
{
front = 0;
rear = 0;
capacity = cap;
size = 0;
data = new Orders[capacity];
}
void Add_orderCOD(int ID, int quan, string name, string address, string Mobile_no)
{
Orders order;
order.cloth_ID = ID;
order.quantity = quan;
order.name = name;
order.Address = address;
order.Mobile_number = Mobile_no;
data[rear] = order;
rear = (rear + 1) % capacity;
size++;
}
void Add_orderCP(int ID, int quan, string name, string address, string Mobile_no,string cardno, string cvv, string holname)
{
Orders order;
order.cloth_ID = ID;
order.quantity = quan;
order.name = name;
order.Address = address;
order.Mobile_number = Mobile_no;
order.cardnum = cardno;
order.cvv = cvv;
order.holdername = holname;
data[rear] = order;
rear = (rear + 1) % capacity;
size++;
}
int printCOD()
{
cout << "\t\t\t\t\tCash on Delivary Orders" << endl;
cout << endl;
cout << "_________________________________________________________________" << endl;
cout << "Name\t" << "Cloth Id\t" << "Quantity\t" << "Address\t\t" << "Mobile No" << endl;
cout << "_________________________________________________________________" << endl;
if (size == 0)
{
cout << "Queue is empty" << endl;
return -1;
}
else
{
int index = front;
for (int i = 0; i < size; i++)
{
cout << data[index].name << " " << "\t" << data[index].cloth_ID << " " << "\t\t" << data[index].quantity << "\t\t" << data[index].Address << "\t\t" << data[index].Mobile_number << endl;
index = (index + 1) % capacity;
}
cout << endl;
}
}
int printCP()
{
cout << "\t\t\t\t\tCard Payment Orders" << endl;
cout << endl;
cout << "____________________________________________________________________________________________________________" << endl;
cout << "Name\t" << "Cloth Id\t" << "Quantity\t" << "Address\t\t" << "Mobile No\t" << "Card No\t\t" << "CVV\t" << "Holder Name" << endl;
cout << "____________________________________________________________________________________________________________" << endl;
if (size == 0)
{
cout << "Queue is empty" << endl;
return -1;
}
else
{
int index = front;
for (int i = 0; i < size; i++)
{
cout << data[index].name << " " << "\t" << data[index].cloth_ID << " " << "\t\t" << data[index].quantity << "\t\t" << data[index].Address << "\t\t" << data[index].Mobile_number << "\t" << data[index].cardnum << "\t\t" << data[index].holdername << "\t" << data[index].cvv << endl;
index = (index + 1) % capacity;
}
cout << endl;
}
}
};