Unexpected unqualified-if before "{" token

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <stdio.h>
int size1=7;
int Minimum(float values[], int size1);
{
    float minimum1=1000;
    for(i=0;i<size1;i++)
    {
        if(values[i]<minimum1)
            minimum1=values[i];
    }
    return minimum1;
}

int Maximum(float values[],int size1);
{
    float maximum1=0;
    for(i=0;i<size1;i++)
    {
        if(values[i]>maximum1)
            values[i]=maximum1;
    }
    return maximum1;
}
int Average(float values[],int size1);
{
    float average1=0,sum=0;
    for(i=0;i<size1;i++)
    {sum=sum+values[i];}
    average1=sum/7;
    return average1;
}
void StatisticsSubMenu(float values[],int size1);
{   int j;
    printf("Press 1 to display the values. \n");
    printf("Press 2 for an average value from all values. \n");
    printf("Press 3 for the lowest value. \n");
    printf("Press 4 for the highest vlue. \n");
    printf("Press 5 for the most common value. \n");
    printf("Press 0 to back. \n");
    scanf("%d",&j);
    if(j==1)
    {
        for(i=0;i<size1;i++)
        {
            printf("%f  ",values[i]);
        }
    }
    if(j==2)
    {

        printf("The average value is %f .\n",Average(values[]),size1);
    }
    if(j==3)
    {
        printf("The lowest value is %f .\n",Minimum(values[]),size1);
    }
    if(j==4)
    {
        printf("The highest value is %f .\n",Maxium(values[]),size1);
    }
    if(j==0)
        break;


}
int main()
{   int i;
    float values[7]={10.1, 9.2, 7.9, 9.2, 13.0, 12.7, 11.3};

    return 0;
}

The error is C:\Users\Administrator\Desktop\Work\Programming\function\main.cpp|4|error: expected unqualified-id before '{' token|

It's been bugging me for sometime and i've tried going through it multiple times.From what i understand all of my functions are wrong , since removing either of them doesn't work.
When you implement functions, you don't put semicolon at the end. You do that for declarations only

1
2
3
4
5
6
7
8
9
int SomeFunction(x,y)  //note no semicolon here
{
 ...
}

int main()
{
...
}



or

1
2
3
4
5
6
7
8
9
10
11
int SomeFunction(x,y);  //semicolon here but function implemented after main

int main()
{
...
}

int SomeFunction(x,y)  //note no semicolon here
{
 ...
}

Topic archived. No new replies allowed.