I have no clue how to correct my errors, can someone please help?

#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;
}


I have to output the mean with one decimal place and then I have to find the standard deviation with four decimal places. I have no clue how im suppose to do this correctly or how I am suppose to fix these errors


Here are the errors
stats.cpp:7: error: expected initializer before numeric constant
stats.cpp:8: error: expected initializer before numeric constant
stats.cpp:9: error: expected initializer before numeric constant
stats.cpp:10: error: expected initializer before numeric constant
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


I dont know how to make a source code, im new to c++, sorry
Really im not sure what the error -Expected unqualified-id before ""-
or the error -Expected initializer- means
Last edited on
Well you cant have a "." in the variable names. Apart from this what are "these" errors? Did you compile this? Post the errors then.

And post the source code in the "<>" tag from the Format menu that appears to the right when you post on the forum.
Topic archived. No new replies allowed.