Plz解决了这个问题 [英] Plz solve this problem

查看:84
本文介绍了Plz解决了这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用c ++编写类照片的定义,如下所示:
私有成员
pno //照片编号的数据成员整数
类别//数据成员用于照片类别字符串
展览//展览馆的数据成员(字符串)

fixexhibit
//成员函数分配
//展览馆是每个类别
//如下表所示

类别展览
古董zaveri
现代johsen
经典terenida

公共成员
注册()一个允许用户输入值的函数
// pno,category并调用fixexhibit()函数

查看全部()
//显示所有数据成员的功能。





我尝试过:



 #include< iostream.h> 
#include< conio.h>
#include< string.h>
#include< stdio.h>
class pic
{
int pno;
char类别[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;
得到(类别);
// fixlocaton();
}
void pic :: seeall()
{
cout<< pno<<<<<< location<< endl;
};
void main()
{
clrscr();
pic h;
h.enter();
getch();
}

解决方案

我们不做你的功课:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



再次阅读问题,并做到这一点告诉你 - 你展示的代码包括很少或没有它询问的项目。



如果你遇到一个具体的问题,那么请问这个问题,我们会尽力帮助。但是我们不会为你做这一切!


嗯,它看起来并不是一件令人生畏的任务,也不清楚你的问题是什么。

只是一些建议,使用:

  • std :: string 对象而不是 C - 类似于字符数组。
  • 更现代的 C ++ 编译器(您使用的编译器看起来过时)。

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();
}

解决方案

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).


这篇关于Plz解决了这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆