Expected unqualified-id

I've been working on this lab project for a few hours, and have almost all of it finsihed, but I don't understand these errors. I'm not very good at programming and am pretty new to it, so any help at all would be wonderful! I know it's something stupid, but I just can't figure it out. Thank You!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 int Homer,Lisa,Ralph,a,b,c;
    double avr , std_Dev;
    std::cout<< "Enter score in Homer : "; (Error here)
    int >> Homer >> std::endl;
    std::cout<< "Enter score in Lisa : ";  (Error here)
    int >> Lisa >> std::endl;
    std::cout<< "Enter score in Ralph : "; (Error here)
    int >> Ralph >> std::endl;
    avr = (Homer+Lisa+ Ralph)/3;
    a= Homer - avr;
    b = Lisa - avr;
    c = Ralph - avr;
    std_Dev = sqrt( (a*a)+(b*b)+(c*c) / 3 );
    
    std::cout << " the average of the exam scores :" << avr << std::endl;
    std::cout << "the standard deviation of the exam scores :" << std_Dev << std::endl;
    return 0;
}
You should be declaring all those numbers as doubles, not integers.
I did that, but I still get the same error messages

int Homer,Lisa,Ralph,a,b,c;
double avr , std_Dev;
std::cout<< "Enter score in Homer : ";
double >> Homer >> std::endl; (Error here)
std::cout<< "Enter score in Lisa : ";
double >> Lisa >> std::endl; (Error here)
std::cout<< "Enter score in Ralph : ";
double >> Ralph >> std::endl; (Error here)
avr = (Homer+Lisa+ Ralph)/3;
a= Homer - avr;
b = Lisa - avr;
c = Ralph - avr;
std_Dev = sqrt( (a*a)+(b*b)+(c*c) / 3 );


Do I have to change the int Homer, Lisa, Ralph to a double as well?

int Homer,Lisa,Ralph,a,b,c;



Thank You
Your error is here:
double >> Homer >> std::endl; (Error here) You should be using cin. Try reading this whole page: http://www.cplusplus.com/doc/tutorial/basic_io/

However, here: int Homer,Lisa,Ralph,a,b,c;

These will need to be doubles if you want sensible answers.
Last edited on
Topic archived. No new replies allowed.