struct opgave genereer_opgave(void){ struct opgave blok; int getal1,getal2,oplossing; char operand; do{ getal1 = geef_random_getal(0,10); }while(zit_in_getallen(getal1)); do{ getal2 = geef_random_getal(0,10); }while(zit_in_getallen(getal2)); do{ operand = geef_random_bewerking(); }while(!heeft_gehele_oplossing(getal1,getal2,operand)); switch(operand){ case '*': oplossing = getal1*getal2; break; case '/': oplossing = (int) getal1/getal2; break; case '+': oplossing = getal1 + getal2; break; case '-' oplossing = getal1 - getal2; break; default: oplossing = -1; break; } blok.getal1 = getal1; blok.getal2 = getal2; blok.operand = operand; blok.oplossing = oplossing; return blok; }