ok, fino al primo pezzo ci ero arrivato.. grazie..
per passare a una funzione un array nn basta fare come al solito:
???int miaFunzione (int n[9])
{
}
EDIT: il problema della riassegnazione dei rand nn si pone perché la randomizzazione é all'interno del do-while e ripete tutto... almeno a me va....
EDIT2:
ho provato a fare una funzione che serve per agiornare i file di testo... il problema adesso é il passaggio deid ati alla funzione:
Funzione:
Passaggio alla funzione:int tokens (int t[4], string fat, int totokens) {
ifstream tokensmachine ("machine.txt");
if (fat == "assign") {
tokensmachine >> t[1];
} else if (fat == "relone") {
t[3] = t[1]-1;
tokensmachine >> t[3];
} else if (fat == "win") {
t[3] = t[1]-totokens;
tokensmachine >> t[3];
}
tokensmachine.close();
ifstream tokensmember ("tokens.txt");
if (fat == "assign") {
tokensmember >> t[2];
} else if (fat == "relone") {
t[4] = t[2]-1;
tokensmember >> t[4];
} else if (fat == "win") {
t[4] = t[2]+totokens;
tokensmember >> t[4];
}
tokensmember.close();
}
sbaglio nel passaggio dell array t? AIuto please.. ciao e grazie..fat = "assign";
tokens(int t[4], int fat, int totokens);