Hi to everybody! I'm writing a program that has to simulate a working system for deliveries of goods to some cities. I get several mistakes from the compiler while temporarly checking the code but they can't point me out the problem good enough.. Therefore I dare to bother you with my question, namely - what's the problem? ;) Here I paste a part of the code. Thank you all in advance!
namespace Error {
struct Syntax_err {
const char* p;
Syntax_err (const char *q) {p=q;};
};
struct File_err {};
}
namespace Truck_Manager {
using namespace Time;
using namespace Error;
enum Dest { Aachen, Bfeld, Dortm, Duis, Duess, Essen, Kassel, Koeln, Muenstr, WTal };
enum Stat { Jam, Flat_tyre, Accident, Load_Unload, Driving };
class Truck {
private:
unsigned km_passed;
unsigned km_overall;
Stat curr_stat;
Dest curr_dest;
list<Dest> QDPs[50]; // QDPs == Queued Delivery Places
Time_Sim so_far; // Time driven so far
short occ_capacity; // occupied freight capacity
bool mutable dest_success; // True upon successful destination
public: // Maintenance Functions
Truck (unsigned km_p, unsigned km_all, Dest a=(rand()%8), Time_Sim a, short cap, Stat a=(rand()%8));
void Print_WI(Truck T, short num) const; // current Working Info
inline void add_dest(Truck T, Dest new_d); // adds a new destination for a truck
int add_stat(Truck T, Stat new_s); // adds event for a given truck
int tmp_save(void); // temp save upon dest_success=1
void update_queue(Truck T, Dest new_curr_dest, bool a);
// Output Functions
inline unsigned get_km_passed(void) const { return km_passed;};
inline unsigned get_km_overall(void) const { return km_overall;};
inline Stat get_stat(void) const {return curr_stat;};
inline Dest get_dest(void) const {return curr_dest;};
//inline void get_tim_e(Time_Sim a) const {Time_Sim::print(Time_Sim a);}; // ?????????
inline short get_capacity(void) const {return occ_capacity;};
};
}
void Truck_Manager::Truck::Print_WI(Truck T, short num) const {
cout << "\n\n\n\n\n" << " Working info for Truck " << num << ": ";
cout << "\n Km overall: " << get_km_overall() << "\n Status: " << get_stat();
cout << "\n Current Destitantion: " << get_dest() << "\n Driving time: ";// << get_tim_e(so_far);
cout << "\n Occupied freights: " << get_capacity() << " (" << (8-get_capacity()) << " free)\n";
system("PAUSE");
}
void Truck_Manager::Truck::update_queue(Truck T, Dest new_curr_dest, bool a) {
typedef list<Dest>::iterator LI;
if(!tmp_save()) throw File_err;
curr_dest = new_curr_dest;
for(LI i=QDPs.begin(); i<QDPs.end(); ++i)
QDPs.push_front(*i);
a = true;
}
inline void Truck_Manager::Truck::add_dest(Truck T, Dest new_d) {
QDPs.push_back(new_d);
}
int Truck_Manager::Truck::add_stat(Truck T, Stat new_s) {
curr_stat = new_s;
}