I agree on the code tags! Not hard to do, makes it a lot easier to see what's going on.
You've worked hard on this, I can see. But your implementation has boxed you into some absolutes - you only allow for a maximum of 10 buses, and with them 10 drivers (don't have to be unique), etc. . .Have you ever used or learned about vectors?
Also: you #include <string> but all your string-like variables are old-style array[]. Couldn't most of those be strings?
Also:
Assigning p as a static global variable for what should be a single-use value (number of buses) makes it very unwise to use p as a counter, pointer, etc. for any other part of the program. If you need to keep a static count of your buses, use something distinctive, like . . . static int buscount; so you always know when you're accessing that value, and more importantly, when you're altering it. For example:
1 2 3 4 5
|
void a::position(int l)
{
int s = 0; p = 0; //since p is global the semicolon before p doesn't cause an error
//but it resets your bus count to zero.
//later it gets increased to the seat capacity of the bus (32).
|
I'm not a big fan of non-descriptive variables either: in that code fragment, what is being received by the method in variable (int l)? What are
int s = 0, p = 0
going to do in the method? If you have a small loop using a for( i = 0; i < variable ; i++) it's obvious, no problem. But when the declared variable is way down inside several code blocks. . .hard to make it understandable.