Hello Eveybody
This is my question
Define a class named HOUSING in C++ with the following descriptions:
Private members
REG_NO integer(Ranges 10 — 1000)
NAME Array of characters(String)
TYPE Character
COST Float
Public Members
• Function Read_Data( ) to read an object of HOUSING type
• Function Display() to display the details of an object
• Function Draw Nos( ) to choose and display the details of 2 houses selected randomly from an array of 10 objects of type HOUSING Use random function to generate the registration nos. to match with REGNO from the array.
Now I' trying to do this by this way
Code:
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
class housing
{
private:
int REG_NO;
char NAME[10];
char TYPE;
float COST;
public:
void Read_Data();
void Display();
void DrawNos(housing);
};
void housing::Read_Data( )
{
cout<<"Enter Registration No: ";
cin>>REG_NO;
cout<<"Enter Name: ";
cin>>NAME;
cout<<"Enter Type: ";
cin>>TYPE;
cout<<"Enter cost: ";
cin>>COST;
}
void housing::Display()
{
}
void housing::DrawNos(housing* h1[])
{
int N=10;
int randomREG=random(10);
N=random(2);
cout<<h1[N]->REG_NO;
}
void main()
{
int i=0;
housing* h[5];
for(i=0;i<5;i++)
{
h[i]->Read_Data();
}
for(i=0;i<5;i++)
{
h[i].DrawNos(h); // I am trying to pass the array of object to DrawNos function but getting error
}
}
I am tryin to pass the entire array of object in DrawNos(). but getting comilation error -
32: 'housing:
rawNos(housing * *)' is not a member of 'housing'
48: Structure required on left side of . or .*
What is the problem? How can I pass the array of object in function and use it.
Please help me with this problem.