
te putarra
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.60 KB | hits: 42 | expires: Never
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Persona {
string nom;
bool dona;
int edat;
};
int main() {
int n, aux;
aux = 0;
cin >> n;
vector<Persona> llista(n);
string sexe;
for (int i = 0; i < n; ++i) {
cin >> llista[i].nom >> sexe >> llista[i].edat;
if (sexe == "dona") llista[i].dona = true;
else {
llista[i].dona = false;
if (llista[i].edat > aux) aux = llista[i].edat;
}
}
for (int i = 0; i < n; ++i) {
if (llista[i].dona and llista[i].edat < aux) cout << llista[i].nom << " " << llista[i].edat << endl;
}
}