input/output and array

I have a input file (.txt) which have books in the format:
catalogue_number, author_last_name, author_first_name, book_title, genre, availability

I have to list the books by author last name in ascending alphabetical order.
It needs to output in a output file(.txt)

Please Help me!!!! I really need it. These are my codes so far:
This is my 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
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

#include "book.h"
#include "book.cpp"
using std::ifstream;
using std::ofstream;

int main()
{
    Book book;
    ifstream inStream;
    ofstream outStream;

    
    inStream.open("library_holdings.txt");
    if(inStream.fail())
    {
       cout <<"Input file opening failed.\n";
       exit(1);
    }
    outStream.open("computational_task_1.txt");
    if(outStream.fail())
    {
       cout <<"Output file opening failed.\n";
       exit(1);
    }
    
     outStream<<Book.output();                                            
    

    
   
   inStream.close();
   outStream.close();
   system ("PAUSE");
   return 0;
}
This is my 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
#include <stdlib.h>
#include <iostream>
#include <stdlib.h>
#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::output()
{
     Book[50] = {"Catalogue_Number", "Author_Last_Name", "Author_First_Name", "Book_Title", "Genre", "Availability"}
     Book Books[50]
    {
       for(int i = 0; i <(ARRAYSIZE);i++){
       Books[].Set(Book[i]);
    }
    cout<<catalogue_number<<author_last_name<<author_first_name<<book_title<<genre<<availability;
}
This is my 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
#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;


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.