Click here to Skip to main content
15,039,214 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
write the definition of a class photo in c++ with following description
private members
pno //data member of photo number an integer
category //data member for photo category a string
exhibit //data member for exhibition gallery (a string)

fixexhibit
//a member function to assign
//exhibition gallery is per category
//as shown in the following table

category  exhibit
antique    zaveri
modern    johsen
classic    terenida

public members
Register() a function to allow user to enter values
//pno, category and call fixexhibit () function

view all()
// a function to display all the data members.


What I have tried:

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class pic
{
int pno;
char Category[50];
char location[50];
void fixlocation();
public:
void enter();
void seeall();
};
void pic::fixlocation()
{
if(strcmpi(Category,"classic")==0)
strcpy(location,"Amina");

else if(strcmpi(Category,"Modren")==0)
strcpy(location,"Jim Plag");

else if(strcmpi(Category,"Antique")==0)
strcpy(location,"ustad khan");
}
void pic::enter()
{

cin>>pno;
gets(Category);
//fixlocaton();
}
void pic::seeall()
{
cout<<pno<<Category<<location<<endl;
};
void main()
{
clrscr();
pic h;
h.enter();
getch();
}
Posted
Updated 2-May-17 22:20pm

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Read the question again, and do exactly what it is telling you - the code you show includes little or none of the items it asks about.

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
   
Well, it doesn't look a daunting task and it is not clear what is your problem.
Just a couple of suggestions, use:
  • std::string objects instead of C-like array of characters.
  • A more modern C++ compiler (the one you are using looks outdated).
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900