Hi all,
I'm writing a program which reads and calculates students grades. I have =
a Student_info struct with its member functions in a Student_info.h.
when i compile, i get the error=20
no match for istream & >> {unknown type}
in the Student_info.cpp file. Can anyone help me. The definition for the =
problem funtion is=20
istream& Student_info::read(istream& is)
{
//read and store the student's name and midterm and final exams =
grades
is >> name >> midterm >> final;
=20
read_hw(is, homework); //read and store all the stud =
homework grades
return is;
}
BELOW IS THE HEADER FILE;
#ifndef GUARD_Student_info_h
#define GUARD_Student_info_h
// Student_info.h header file
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
class Student_info {
public:
Student_info();
Student_info(std::istream&);
std::string name() const {return n;}
bool valid() const {return !homework.empty();}
std::istream& read(std::istream&);
double grade() const;
private:
std::string n;
double midterm, final;
std::vector<double> homework;
};
bool compare(const Student_info&, const Student_info&);
//std::istream& read(std::istream&, Student_info&);
std::istream& read_hw(std::istream&, std::vector<double>&);
#endif
Napoleon.
|