Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Xarxa::ordenar_vector(vector<Tren>& v) {
- int i, j;
- i = 0;
- while (i < v.size()) {
- j = 0;
- while (j < v.size()) {
- if (v[i].consultar_arribada() < v[j].consultar_arribada()) {
- Tren aux = v[i];
- v[i] = v[j];
- v[j] = aux;
- }
- else if (v[i].consultar_arribada() == v[j].consultar_arribada() and v[i].consultar_id() < v[j].consultar_id()) {
- Tren aux = v[i];
- v[i] = v[j];
- v[j] = aux;
- }
- ++j;
- }
- ++i;
- }
- }
Add Comment
Please, Sign In to add comment