Hi ,
I am new to c++. I am reading "C++ How to Program" .In one example author divided the program into 3 files.

The first one is Gradebook.h which contains prototypes.
second Gradebook.cpp which contains actual implementations of member functions of Gradebook.h.

last file is fig03-14.cpp which contains objects to the classes and calling the member functions.

I dont know how to compile these multiple files. I am DEV-C++ compiler.
Any one give me the procedure how to compile these 3 files.

First create a project, copy the three files into the project's directory and add the files to the project. In the Project tab located in the far left panel right-click on the project name, for example Project1 and select Add To Project

My book.h program contains

#include<string>
using std::string;


class book
{
private:
string courseName;


public:
book( string );
void setCourseName(string);
string getCourseName();
void display();
};


book.cpp contains :


#include<iostream>
using std::cout;
using std::cin;
using std::endl;


#include "book.h"


book::book(string name)
{
setCourseName(name);
}


void book::setCourseName(string name)
{
courseName = name;
}


string book::getCourseName()
{
return courseName;
}


void book::display()
{
cout << "Welcome to the book for" << endl << getCourseName() << endl ;
}


fig03-14 contains:


#include<iostream>
using std::cout;
using std::cin;
using std::endl;


#include "book.h"


int main()
{
book mybook("Hi");
mybook.getCourseName();


char s;
cin >> s;


return 0;
}

I copied these files into one project and trying to compile ,it is giving blank screen.

Edited 3 Years Ago by happygeek: fixed formatting

First create a project, copy the three files into the project's directory and add the files to the project. In the Project tab located in the far left panel right-click on the project name, for example Project1 and select Add To Project

Thank u very much . i got it. thank you.

This question has already been answered. Start a new discussion instead.