Create a Book Publisher Management program in C++ Language
#include<conio.h>
#include<iostream.h>
#include<string.h>
class book
{
char b_title[30],b_author[30],b_publisher[30],b_edition[10];
double b_code;
public:
void input();
void output();
void change(int);
};
void book::input()
{
cout<<"\n\tEnter Book Code :-\t";cin>>b_code;
cout<<"\n\tEnter Book Title :-\t";cin>>b_title;
cout<<"\n\tEnter Book Edition :-\t";cin>>b_edition;
cout<<"\n\tEnter Book Author :-\t";cin>>b_author;
cout<<"\n\tEnter Book Publisher :-\t";cin>>b_publisher;
cout<<endl;
}
void book::output()
{
cout<<"\n\tBook Code :-\t"<<b_code;
cout<<"\n\tBook Title :-\t"<<b_title;
cout<<"\n\tBook Edition :-\t"<<b_edition;
cout<<"\n\tBook Author :-\t"<<b_author;
cout<<"\n\tBook Publisher :-\t"<<b_publisher;
cout<<endl;
}
void book::change(int temp)
{
if(b_code==temp)
{
cout<<"\n\tEnter Book Code :-\t";cin>>b_code;
cout<<"\n\tEnter Book Title :-\t";cin>>b_title;
cout<<"\n\tEnter Book Edition :-\t";cin>>b_edition;
cout<<"\n\tEnter Book Author :-\t";cin>>b_author;
cout<<"\n\tEnter Book Publisher :-\t";cin>>b_publisher;
cout<<endl;
return;
}
}
void main()
{
textcolor(115);
clrscr();
int me=1;
int i=0;
book obj[10];
char b_title[30],b_author[30],b_publisher[30],b_edition[10];
int b_code,m;
while(me)
{
cout<<"Enter 1 For Enter New\nEnter 2 For Change\nEnter 3 For Display\nEnter 4 For Exit\n";
cin>>m;
switch(m)
{
case 1: clrscr();
if(i>9)
{
cout<<"Only 9";
return;
}
obj[i].input();
i=i+1;
break;
case 2: cout<<"Enter The Book Id For Change";
int temp=0;
cin>>temp;
for(int p=0;p<i;p++)
{
obj[p].change(temp);
}
break;
case 3: for(p=0;p<i;p++)
{
obj[p].output();
}
break;
case 4: me=0;
break;
}
}
getch();
}
#include<iostream.h>
#include<string.h>
class book
{
char b_title[30],b_author[30],b_publisher[30],b_edition[10];
double b_code;
public:
void input();
void output();
void change(int);
};
void book::input()
{
cout<<"\n\tEnter Book Code :-\t";cin>>b_code;
cout<<"\n\tEnter Book Title :-\t";cin>>b_title;
cout<<"\n\tEnter Book Edition :-\t";cin>>b_edition;
cout<<"\n\tEnter Book Author :-\t";cin>>b_author;
cout<<"\n\tEnter Book Publisher :-\t";cin>>b_publisher;
cout<<endl;
}
void book::output()
{
cout<<"\n\tBook Code :-\t"<<b_code;
cout<<"\n\tBook Title :-\t"<<b_title;
cout<<"\n\tBook Edition :-\t"<<b_edition;
cout<<"\n\tBook Author :-\t"<<b_author;
cout<<"\n\tBook Publisher :-\t"<<b_publisher;
cout<<endl;
}
void book::change(int temp)
{
if(b_code==temp)
{
cout<<"\n\tEnter Book Code :-\t";cin>>b_code;
cout<<"\n\tEnter Book Title :-\t";cin>>b_title;
cout<<"\n\tEnter Book Edition :-\t";cin>>b_edition;
cout<<"\n\tEnter Book Author :-\t";cin>>b_author;
cout<<"\n\tEnter Book Publisher :-\t";cin>>b_publisher;
cout<<endl;
return;
}
}
void main()
{
textcolor(115);
clrscr();
int me=1;
int i=0;
book obj[10];
char b_title[30],b_author[30],b_publisher[30],b_edition[10];
int b_code,m;
while(me)
{
cout<<"Enter 1 For Enter New\nEnter 2 For Change\nEnter 3 For Display\nEnter 4 For Exit\n";
cin>>m;
switch(m)
{
case 1: clrscr();
if(i>9)
{
cout<<"Only 9";
return;
}
obj[i].input();
i=i+1;
break;
case 2: cout<<"Enter The Book Id For Change";
int temp=0;
cin>>temp;
for(int p=0;p<i;p++)
{
obj[p].change(temp);
}
break;
case 3: for(p=0;p<i;p++)
{
obj[p].output();
}
break;
case 4: me=0;
break;
}
}
getch();
}
Create a Book Publisher Management program in C++ Language
Reviewed by Unknown
on
6:18:00 PM
Rating:
No comments: