بليز في حدا يساعدني بحل سوال اوبجكت ضروري بكرة اذا في مجال بليز"هاد السوال" بليز ضروري
declare a class called Graph the has the following:
data memebers:
int number_of_edges
int number_of_nodes
Relations R
where Relations is:
class Relations
{
int size;
int * ptr;
public:
Relations(int s=10)
{ size=(s>0?s:10);
ptr=new int [size];
for (int i=0;i<=9;i++)
prt[i]=0;}
void set_an_edge(int node_number)
{
ptr[node_number-1]++;}
}};//
in Graph class define the follwing member functions:
-constructor: that set all data memebers with default values( number_of_nodes must be equal to size for this class).
-set and get functions for each data member.
-print function that print the values of all data memembers.
and a friend function called compare_values that compares the values of 2 Graph objects
the result will be true for equal objects.
overload the following operators:
->> to read the values of car object
-<< to print the values of car object
- ! object1 of type Relations to change the values of the array for object1 as follows:
the value for ptr[i] will equal the value of the previous element ptr[i-1]
- + to find the sum of 2 objects of type Graph.
in main declare 2 arrays called test_array1,and test_array2 of type Graph then execute the following:
-read the values of the arrays
-print the values of the arrays
-compare the 2 arrays
-call operator! function.
-call operator+ function


رد مع اقتباس

مواقع النشر (المفضلة)