[Error] expected unqualified-id before '{' token

Hi everybody! I got a problem with the code below. It should find the maximum and minimum values in an array, but it doesn't work cause of an error in line seven: [Error] expected unqualified-id before '{' token. I have no clue what it means and how to resolve it. Can anyone help me? Thank you!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 #include <iostream>
#include <stdlib.h>
using namespace std;

void chiedilunghezza ();
int N;
{do
{cout<<"Inserisci il numero di valori dell'insieme: ";
cin>>N;}
while ( N>1 || N<100);
}

void caricamentovettore ();
int I, V[100];
{for (I=1; I<=N; I=I+1)
{cout<<"Iserisci numero ";
cin>>V[I];
}
}

void confronto ();
int min, max;
max=V[I];
min=V[I];
{for (I=1; I<=N; I=I+1)
{if (V[I]>=max)
{V[I]=max;}
{if (V[I]<=min)
{V[I]=min;}
}
}
}
{cout<<"Il massimo e'"<<max<< ("\n");
cout<<"il minimo e'"<<min<< ("\n");
}

int main(void) {
	{cout<<"PROGRAMMA PER TROVARE IL MASSIMO E IL MINIMO DI UN INSIEME DI NUMERI DATI\n";}
	chiedilunghezza ();
	caricamentovettore ();
	confronto ()
	}
	return 0;
}
A good tip to keep in mind is if the compiler tells you the line they found an error at, you should check the lines above and below it as well. And I would highly suggest reading up on syntax of a function body before you try to do something else with your code.

Hint: a typical function and its definition goes like this...
1
2
3
function()
{
}

Topic archived. No new replies allowed.