Can someone help me with this code?

#include <iostream>
using namespace std;


float square_1 = 47;
float square_2 = 42;
float square_3 = 43;
float square_4 = 49;

{
score_1 = sqrt (4 * 2.71 *(square_1 - square_1)^2) / 4 - 1
score_2 = sqrt (4 * 2.71 *(square_2 - square_2)^2) / 4 - 1
score_3 = sqrt (4 * 2.71 *(square_3 - square_3)^2) / 4 - 1
score_4 = sqrt (4 * 2.71 *(square_4 - square_4)^2) / 4 - 1
}

mean == (score_1 + score_2 + score_3 + score_4)/4 - 1;
{
square_1 =(score_1 - mean)
square_1 = pow(score_1 - mean - 2);
}
{
square_2 =(score_2 - mean)
square_2= pow(score_2 - mean - 2);
}
{
square_3 =(score_3 - mean)
square_3 = pow(score_3 - mean - 2);
}
{
square_4 =(score_4 - mean)
square_4 = pow(score_4 - mean - 2);
}
{
cout << mean;
}


ERRORS
***
stats.cpp:12: error: expected unqualified-id before â{â token
stats.cpp:19: error: expected constructor, destructor, or type conversion before â==â token
stats.cpp:20: error: expected unqualified-id before â{â token
stats.cpp:24: error: expected unqualified-id before â{â token
stats.cpp:28: error: expected unqualified-id before â{â token
stats.cpp:32: error: expected unqualified-id before â{â token
stats.cpp:36: error: expected unqualified-id before â{â token
1) You have loads of curly brackets, for no reason
2) You haven't declared mean in ln. 19
3) You have used the == (equality) operator instead of the = (assignment) operator in ln. 19
You didnt have your program in int main(){}.

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
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    float square_1 = 47;
    float square_2 = 42;
    float square_3 = 43;
    float square_4 = 49;

    {
        score_1 = sqrt (4 * 2.71 *(square_1 - square_1)^2) / 4 - 1;
        score_2 = sqrt (4 * 2.71 *(square_2 - square_2)^2) / 4 - 1;
        score_3 = sqrt (4 * 2.71 *(square_3 - square_3)^2) / 4 - 1;
        score_4 = sqrt (4 * 2.71 *(square_4 - square_4)^2) / 4 - 1;
    }

    mean == (score_1 + score_2 + score_3 + score_4)/4 - 1;
    {
        square_1 =(score_1 - mean);
        square_1 = pow(score_1 - mean - 2);
    }
    {
        square_2 =(score_2 - mean);
        square_2= pow(score_2 - mean - 2);
    }
    {
        square_3 =(score_3 - mean);
        square_3 = pow(score_3 - mean - 2);
    }
    {
        square_4 =(score_4 - mean);
        square_4 = pow(score_4 - mean - 2);
    }
    {
        cout << mean;
    }

}
Last edited on
That kind of helped, i think i can take it from there, thanks
Topic archived. No new replies allowed.