Question: c++ In a two dimensional array, suppose indices represent people and that the value at row i, column of the array is 1 in case

c++ c++ In a two dimensional array, suppose indices represent people and that

In a two dimensional array, suppose indices represent people and that the value at row i, column of the array is 1 in case and are friends and otherwise. Initialize your array to represent the following configuration # 10 1 2 3 4 0 Your array in your implementation should have 1 where you see a star and where there's nothing. a) Write a function that counts how many pairs of friends are represented in the array. Note that each friendship pair appears twice in the array (0 and 1 are friends but also 1 and 0 are friends). So in the example above there are actually only 5 pairs of friends. b) Write a function to check whether two people have a common friend. For example, in the example above, O and 4 are both friends with 3 (so they have a common friend), whereas 1 and 2 have no common friends. The function should have three parameters: a 2D array of integers (1s and Os) representing the friendship relationships and two integers J. The method should return true if there is a k such that is a friend of k and k is a friend of j and return false otherwise. Test the functions in a main program. The main program should print out how pairs of friendship exist using the function in a) and it should get input from user (two numbers) and check if those two numbers (individuals) have a common friend, 1 AB I 1% 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!