Alogarithm steps:
- Start the program
- Write the function and pass one value through that function
- Call that function in the main program
- Pass the value when we call that function
- Compile and run the program
CPP Program For Parameterized Constructor
#include
#include
const int IN = 1;
const int checked_out = 0;
class book
{
char author[40];
char title[40];
int status;
public:
book(char *n, char *t, int s);
int get_status()
{
return status;
}
void set_status(int s)
{
status = s;
}
void show();
};
book::book(char *n, char *t, int s)
{
strcpy(author, n);
strcpy(title, t);
status = s;
}
void book::show()
{
cout<
SAMPLE INPUT AND OUTPUT:
Tom SawyerbyTwainisin.
Moby DickbyMelvilleis
|