Class and header file questions

Hey, is there a way to run this exactly the way it is except without using the (stdlib.h) header file? I am not too familiar with it at all and I had a friend implement it into the code, but I am not sure how it works. I know there are other ways to change a string to an int, I just can't remember them. ( Similar to the way it is used in the 'return' section of the program)

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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <cmath>
#include <string>
#include <fstream>
using namespace std;

enum UserType{Users, Admin};
const unsigned short Max_Titles = 3, Max_Copies = 2,
                         Max_Users = 4, Access_Code = 2;

class BlueBox
{
    string m_inventory[Max_Titles][Max_Copies];
    string m_users[Max_Users][Access_Code];
	 int m_revenue;

	const unsigned short customer(const unsigned int) ;
    void rent(const unsigned int);
    void returns();
    void sales(const string&);
    void admin() const;
    void error(const string& message){system("CLS"); cout << message << endl; exit(0);}
public:
    BlueBox(const string inventory[][Max_Copies], const string users[][Access_Code]);
    void screen();
};

int main()
{
    const string Inventory[][Max_Copies] = {{"Star Wars", "2"},
                                            {"Avengers", "2"},
                                            {"Halloween", "2"}};
    const string Users[][Access_Code] = {{"Guest1", "00"},
                                         {"Guest2", "01"},
                                         {"Guest3", "12"},
                                         {"Admin", "99"}};

    BlueBox dvdStore(Inventory, Users);

    dvdStore.screen();

    return 0;
}

BlueBox::BlueBox(const string inventory[][Max_Copies], const string users[][Access_Code]):m_revenue(0)
{
    for(unsigned short titles = 0; titles < Max_Titles; titles++)
        for(unsigned short copies = 0; copies < Max_Copies; copies++)
            m_inventory[titles][copies] = inventory[titles][copies];

    for(unsigned short user = 0; user < Max_Users; user++)
        for(unsigned short codes = 0; codes < Access_Code; codes++)
            m_users[user][codes] = users[user][codes];
}
void BlueBox::screen()
{
    char answer;

    do
    {
        cout << "BlueBox Video Center\n\nMain Menu: \n" <<
                "1. Rent\n2. Returns\n3. Admin\n4. EXIT\n \nAnswer: ";
        cin >> answer;

        system("CLS");

        switch(answer)
        {
        case '1':
            {
                rent(customer(Users));
                break;
            }
        case '2':
            {
                returns();
                break;
            }
        case '3':
                customer(Admin);
        }
    }while(answer != '4');
}
const unsigned short BlueBox::customer(const unsigned int userType) 
{
    string accessCode;

    if(userType == Users)
        while(true)
        {
            cout << "BlueBox Video Center\n\nCustomer Login:\n Enter Access Code: ";
            cin >> accessCode;

            system("CLS");

            for(unsigned short user = 0; user < Max_Users - 1; user++)
                if(m_users[user][Access_Code - 1] == accessCode)
                    return user;
        }
    else if(userType == Admin)
        while(true)
        {
            cout << "\t\t\tBlueBox Video Center\n\nADMIN Login:\n\nEnter Access Code: ";
            cin >> accessCode;

            system("CLS");

            if(m_users[Max_Users - 1][Access_Code - 1] == accessCode)
            {
                admin();

                break;
            }
        }

    return true;
}
void BlueBox::rent(const unsigned int user)
{
    unsigned short titleCounter = 0;
    char answer;

    while(true)
    {
        cout << "\t\t\tBlueBox Video Center\nWelcome " <<
                m_users[user][0] << "!\n\nWhich title to Rent:\n\n";

        for(unsigned short titles = 0; titles < Max_Titles; titles++)
            if(m_inventory[titles][Max_Copies - 1].at(0) > '0')
                cout << ++titleCounter << ". " << setw(12) << m_inventory[titles][0] << " | " <<
                     m_inventory[titles][Max_Copies - 1] << " copies left\n";

        if(titleCounter == 0)
            error("No DVDS To Rent - Out Of Order! Sorry for the inconvenience\n");

        cout << ++titleCounter << ". Exit\n\nAnswer: ";
        cin >> answer;

        system("CLS");

        if(answer - 48 == titleCounter)
            break;
        else if(answer - 48 > titleCounter || answer - 48 < 1)
        {
            titleCounter = 0;

            continue;
        }
        else
        {
            unsigned short titlePickerCounter = 0;

            for(unsigned short titles = 0; titles < Max_Titles; titles++)
            {
                if(m_inventory[titles][Max_Copies - 1].at(0) > '0')
                    titlePickerCounter++;

                if(answer - 48 == titlePickerCounter)
                {
                    m_inventory[titles][Max_Copies - 1].at(0)--;

                    break;
                }
            }
        }

        titleCounter = 0;
    }
}
void BlueBox::returns()
{
    unsigned short titleCounter = 0;
    char answer;

    while(true)
    {
        cout << "\t\t\tBlueBox Video Center\n\nWhich Title to Return:\n---\n";

        for(unsigned short titles = 0; titles < Max_Titles; titles++)
            if(m_inventory[titles][Max_Copies - 1].at(0) < '2')
                cout << ++titleCounter << ". " << setw(12) << m_inventory[titles][0] << " | " <<
                     2 - atoi(m_inventory[titles][Max_Copies - 1].c_str()) << " copies missing\n";

        if(titleCounter == 0)
        {
            system("CLS");

            return;
        }

        cout << ++titleCounter << ". Exit\n---\nAnswer: ";
        cin >> answer;

        system("CLS");

        if(answer - 48 == titleCounter)
            break;
        else if(answer - 48 > titleCounter || answer - 48 < 1)
        {
            titleCounter = 0;

            continue;
        }
        else
        {
            unsigned short titlePickerCounter = 0;

            for(unsigned short titles = 0; titles < Max_Titles; titles++)
            {
                if(m_inventory[titles][Max_Copies - 1].at(0) < '2')
                    titlePickerCounter++;

                if(answer - 48 == titlePickerCounter)
                {
                    m_inventory[titles][Max_Copies - 1].at(0)++;

                    sales(m_inventory[titles][0]);

                    break;
                }
            }
        }

        titleCounter = 0;
    }
}
void BlueBox::sales(const string& titleName)
{
    cout << "Thank you for returning " << titleName << " within 24 hours!\n---\n";
    cout << "That will cost you $1.00 - Thank you for your business!\n\n";

    system("PAUSE");
    system("CLS");

    m_revenue++;
}
void BlueBox::admin() const
{
    cout << "\t\t\tBlueBox Video Center\n\nAdmin Panel:\n---\n\nCurrent DVDs IN_STOCK:\n-\n";

    for(unsigned short titles = 0; titles < Max_Titles; titles++)
        if(m_inventory[titles][Max_Copies - 1].at(0) > '0')
            cout << setw(12) << m_inventory[titles][0] << " | " <<
                     m_inventory[titles][Max_Copies - 1] << " copies\n";

    cout << "Total Revenue:\n-\n$" << m_revenue << ".00\n\n";

    system("PAUSE");
    system("CLS");
}
Topic archived. No new replies allowed.