#include <iostream.h>
#include <string.h>
class Device
{
private:
int dId;
char dName[10];
int dPrice;
char dManufacturer[20];
public:
Device(int a,int b,char c[],char d[])
{
dId=a;
strcpy(dName,c);
dPrice=b;
strcpy(dManufacturer,d);
}
int getId()
{
return dId;
}
int getPrice()
{
return dPrice;
}
char *getName()
{
return dName;
}
char *getManufacturer()
{
return dManufacturer;
}
};
void main()
{
Device d1(1,20000,"电s脑","中关村");
cout<<d1.getId()<<endl;
cout<<d1.getPrice()<<endl;
cout<<d1.getName()<<endl;
cout<<d1.getManufacturer()<<endl;
}
#include <string.h>
class Device
{
private:
int dId;
char dName[10];
int dPrice;
char dManufacturer[20];
public:
Device(int a,int b,char c[],char d[])
{
dId=a;
strcpy(dName,c);
dPrice=b;
strcpy(dManufacturer,d);
}
int getId()
{
return dId;
}
int getPrice()
{
return dPrice;
}
char *getName()
{
return dName;
}
char *getManufacturer()
{
return dManufacturer;
}
};
void main()
{
Device d1(1,20000,"电s脑","中关村");
cout<<d1.getId()<<endl;
cout<<d1.getPrice()<<endl;
cout<<d1.getName()<<endl;
cout<<d1.getManufacturer()<<endl;
}