Weird errors in my code

My arduino software is giving me errors and I don't understand how to fix them. Could comeone please help me.

error message:
liedetector:3:1: error: expected primary-expression before 'int'

int berekenGemiddelde() {

^

liedetector:60:1: error: expected ',' or ';' at end of input

}

^

exit status 1
expected primary-expression before 'int'

I hope someone is able to help. Any help is appreciated

[code]
//int gemiddeld = 680;
int gemiddeld =   
int berekenGemiddelde() {
    int waardes[10];
    for(int i=0; i<=10; i++) {
      waardes[i] = analogRead(A0);
      delay(1000);
    }
    for(int j=0; j<=10; j++ ) {
     int totaal = totaal + waardes[j];
     delay(1001);
       if (j == 10) {
         gemiddeld = totaal/10;
         return gemiddeld;
         digitalWrite(bLamp, HIGH);
      }
    }   
  }

int gLamp = 2;
int bLamp = 3;
int rLamp = 4;
void setup()
{
  //beschrijf de functies van de verschillende pins
  Serial.print("Hello");
  Serial.begin(9600);
  pinMode(gLamp, OUTPUT);
  pinMode(bLamp, OUTPUT);
  pinMode(rLamp, OUTPUT);
  //maak lampjes knipperen bij opstarten.
  digitalWrite(gLamp, HIGH);
  delay(500);
  digitalWrite(rLamp, HIGH);
  delay(500);
}

void loop()
{
  //test de gemeten gegevens aan het gemiddelde om te bepalen of er gelogen wordt
  if (analogRead(A0) <  gemiddeld - (0.18*gemiddeld))
  {
  digitalWrite(rLamp, HIGH);
  }
  else
  {
    digitalWrite(rLamp, LOW);
  }
  if (analogRead(A0) > gemiddeld - (0.18*gemiddeld))
  {
    digitalWrite(gLamp, HIGH);
  }
  else
  {
    digitalWrite(gLamp, LOW);
  }

  Serial.println(analogRead(A0));
  delay(20);
}

[/code]

This is the code I use

int gemiddeld =

?

//int gemiddeld = 680;
int gemiddeld =

should be

int gemiddeld = 680;
//int gemiddeld =

Other than that, curly brackets are not necessary if there is only one instruction. So this simplifies your code and makes ity easier (IMHA) to read:

  if (analogRead(A0) <  gemiddeld - (0.18*gemiddeld)) digitalWrite(rLamp, HIGH);
  else digitalWrite(rLamp, LOW);
  if (analogRead(A0) > gemiddeld - (0.18*gemiddeld))  digitalWrite(gLamp, HIGH);
  else digitalWrite(gLamp, LOW);

You see that you may have to work again on these if / else statements. For example :

  if (analogRead(A0) <  gemiddeld - (0.18*gemiddeld))
  {
    digitalWrite(rLamp, HIGH);
    digitalWrite(gLamp, LOW);
  }
  else
  {
    digitalWrite(rLamp, LOW);
    digitalWrite(gLamp, HIGH);
  }

It's not exactly the same, because in your previous code, the analogRead may have changed between each set of test, but I believe that it's in fact what you mean.

         return gemiddeld;
         digitalWrite(bLamp, HIGH);

It is silly to put code after a return statement.

Right, but this function is never called anyway...