c++ programming

These are the errors:
main.cpp:
Line 67: expected primary-expression before "int"
expected ';' before int
Line 87: expected ';' at end of input
main.cpp
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
#include <fstream>
#include <sstream>
 
#include "book.h"
using std::ifstream;
using std::ofstream;
 
void GetBooksFromFile(Book* bookList, int& booksFound)
{
        ifstream inStream;
 
    inStream.open("library_holdings.txt");
 
        // open the file
    if (inStream.fail() == false)
        {               
                std::string theLine;
 
                // read a line at a time
                while (std::getline(inStream, theLine))
                {
                        size_t oldPos = 0;
                       size_t newPos = theLine.find_first_of(oldPos);
                       bookList[booksFound].setCatalogue_Number(theLine.substr(oldPos, newPos - oldPos));

                        oldPos = newPos + 1;
                        newPos = theLine.find_first_of(oldPos);
                       bookList[booksFound].setAuthor_Last_Name(theLine.substr(oldPos, newPos - oldPos));

                        oldPos = newPos + 1;
                        newPos = theLine.find_first_of(oldPos);
                        bookList[booksFound].setAuthor_First_Name(theLine.substr(oldPos, newPos - oldPos));
 
                        oldPos = newPos + 1;
                        newPos = theLine.find_first_of(oldPos);
                        bookList[booksFound].setBook_Title(theLine.substr(oldPos, newPos - oldPos));
 
                        oldPos = newPos + 1;
                        newPos = theLine.find_first_of(oldPos);
                        bookList[booksFound].setGenre(theLine.substr(oldPos, newPos - oldPos));
 
                        oldPos = newPos + 1;
                        newPos = theLine.find_first_of(oldPos);
                       bookList[booksFound].setAvailability(theLine.substr(oldPos, newPos - oldPos));
                        
                        theLine.clear();
                        booksFound++;
               }
       }
       else
   {
       std::cout <<"Input file opening failed.\n";
     exit(1);
   }
 
       inStream.close();


 
int main()
{
        Book bookList[50]; // enough to hold 50 books
        int numBooksFound = 0;
 
       GetBooksFromFile (bookList, numBooksFound);
   
    ofstream outStream;
   
    outStream.open("computational_task_1.txt");
    if(outStream.fail() == false)
       {
                for (int i=0; i<numBooksFound; i++)
                {
                        outStream               << bookList[i].getCatalogue_Number() << ","
                                                << bookList[i].getAuthor_Last_Name() << ","
                                                << bookList[i].getAuthor_First_Name() << ","
                                                << bookList[i].getBook_Title() << ","
                                                << bookList[i].getGenre() << ","
                                                << bookList[i].getAvailability() << "\n";
                }
        }
        else
    {
       std::cout <<"Output file opening failed.\n";
       exit(1);
    }
book.cpp
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
#include <string>
#include "book.h"
 
std::string Book::getCatalogue_Number() const{
    return catalogue_number;
}
 
std::string Book::getAuthor_Last_Name() const{
    return author_last_name;
}
 
std::string Book::getAuthor_First_Name() const{
    return author_first_name;
}
 
std::string Book::getBook_Title() const{
    return book_title;
}
 
std::string Book::getGenre() const{
    return genre;
}

std::string Book::getAvailability() const{
   return availability;
}
 
void Book::setAuthor_First_Name(const std::string& n)
{
        author_first_name = n;
}
 
void Book::setAuthor_Last_Name(const std::string& n)
{
        author_last_name = n;
}
 
void Book::setAvailability(const std::string& a)
{
        availability = a;
}
 
void Book::setBook_Title(const std::string& t)
{
       book_title = t;
}
 
void Book::setGenre(const std::string& g)
{
       genre = g;
}
 
void Book::setCatalogue_Number(const std::string& c)
{
       catalogue_number = c;
}
book.h:
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
#ifndef _BOOK_H_
#define _BOOK_H_

class Book
{
public:
    void output();
    std::string getCatalogue_Number() const;
    std::string getAuthor_Last_Name() const;
    std::string getAuthor_First_Name() const;
    std::string getBook_Title () const;
    std::string getGenre () const;
    std::string getAvailability () const;
 
       void setCatalogue_Number(const std::string& n);
       void setAuthor_Last_Name (const std::string& n);
       void setAuthor_First_Name (const std::string& n);
        void setBook_Title (const std::string& t);
        void setGenre (const std::string& g);
       void setAvailability (const std::string& a);

private:
    std::string catalogue_number;
    std::string author_last_name;
    std::string author_first_name;
    std::string book_title;
    std::string genre;
    std::string availability;
};
 
#endif 
Topic archived. No new replies allowed.