Quote (SelfTaught @ Apr 8 2014 05:05pm)
About all i have the patience for doing. Should be a decent start though. Not sure how accurate / correct this code is however.
Code
#include <iostream>
#include <queue>
#include <ostream>
/*
* typedefs cos' lazy & less typing
*/
typedef unsigned short USHORT;
typedef const USHORT cUSHORT;
class CCustomer
{
public:
/*
* Parameterized ctor
*/
CCustomer(cUSHORT id, cUSHORT arrival_time, cUSHORT service_time):
m_id(id),
m_arrival_time(arrival_time),
m_service_time(service_time) {};
/*
* ostream overload output
*/
friend std::ostream& operator<<(std::ostream& out, const CCustomer& customer) {
out << "ID: " << customer.m_id
<< "Arrival time: " << customer.m_arrival_time
<< "Service time: " << customer.m_service_time;
return out;
}
/*
* Setters
*/
void set_arrival_time(cUSHORT arrival_time) {
m_arrival_time = arrival_time;
}
void set_service_time(cUSHORT service_time) {
m_service_time = service_time;
}
void set_id(cUSHORT id) {
m_id = id;
}
/*
* Getters
*/
USHORT get_arrival_time() const {
return m_arrival_time;
}
USHORT get_service_time() const {
return m_service_time;
}
USHORT get_id() const {
return m_id;
}
private:
/*
* Encapsulate private variables
*/
USHORT m_arrival_time;
USHORT m_service_time;
USHORT m_id;
};
int main(int argc, const char * argv[]) {
cUSHORT MAX_TIME = 720;
/*
* std::queue for customer class objects
*/
std::queue<CCustomer> customers;
for(USHORT minute = 0; minute < MAX_TIME; ++minute) {
/*
* Do shit that im to lazy to
*/
}
return 0;
}
Quote (KrzaQ2 @ Apr 8 2014 10:23pm)
Lol, this is quickly becoming a caricature of good programming techniques, quite like
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEditionDon't use ugly defines, this is C++, not C.
Don't use raw pointers, unless you're only observing the data, which isn't the case here (the customer is supposed to be removed at departure).
Betta?
This post was edited by SelfTaught on Apr 9 2014 10:14am