Help with code error

Help me please! IM entering this code ,but it is not working for some reason. Its from Accelereated c++ ,Chapter 4. The problem is every time i put this code in a error pops up saying "grade.h no such file" what is wrong with my code?
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
 #include <iostream>
#include <string>
#include  <ios>
#include <stdexcept>
#include <vector>
#include <algorithm>
#include <iomanip>
#include "grade.h"
#include "Student_info.h"
using std:: cin;
using std:: cout;
using std:: domain_error
using std:: endl;
using std:: max;
using std:: setprecision;
using std:: sort;
using std:: streamsize;
using std:: string
using std:: vector;


using namespace std;
int main ()
{
    vector <Student_info> students;
    Student_info record;
    string::size_type maxlen = 0;

    while (read(cin,record)) {

        //find legnth of longest name
        maxlen = max(maxlen, recor.name.size()) ;
        students.push_back(record);

    }
    //alphabetize the student records
    sort (students.begin(), students.end() compare);
    //write the name and grades
    for (vector<Student_info>:;size_type i=0;
    i != students.size(); i++) {
    cout << students[i].name
    << string(maxlen +1 - students[i].name.size(), ' ');
    //compute and write the grade
    try {
    double final_grade = grade (students[i]);
    streamsize prec = cout.precision();
    cout << setprecision(3) << final_grade
    << setprecisoin(prec);


    }
    catch (domain_error e) {
    cout << e.what();
    }
    cout << endl;
}
}

--Justin
Last edited on
Make sure the file grade.h file is in the same directory as the main.cpp file, if it isn't either move to that directory or change the include statement to include the path to the grade.h file.
Unrelated to your problem, but what is the point of lines 10-18?
The individual using statements are defeated by line 22.
Last edited on
@AbstractionAnon Its what the book says I know its completely useless ,but hey why not!

--Justin
If the book has you doing both selective using namespace and using namespace std;, it's a poor example. A book should not be teaching you to write useless lines of code.
Topic archived. No new replies allowed.