/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
class Books {
private:
std::string title;
int size_h, size_w, number_of_pages;
public:
std::string author;
int year;
Books(std::string title, int size_h, int size_w, int number_of_pages, std::string author, int year)
: title(title), size_h(size_h), size_w(size_w), number_of_pages(number_of_pages), author(author), year(year)
{}
void GetData(std::string& title, int& size_h, int& size_w, int& number_of_pages, std::string& author, int& year) const {
title = this->title;
size_h = this->size_h;
size_w = this->size_w;
number_of_pages = this->number_of_pages;
author = this->author;
year = this->year;
}
};
int main() {
Books book1{"Title",3,5,100,"Author",2000};
Books book2{"Title",3,5,100,"Author",2000};
std::string title;
int size_h;
int size_w;
int number_of_pages;
std::string author;
int year;
book1.GetData(title, size_h, size_w, number_of_pages, author, year);
printf("%s,%i,%i,%i,%s,%i\n", title.c_str(), size_h, size_w, number_of_pages, author.c_str(), year);
}