Write a C++ program that : 1. Allow the user to enter the size of the array such as N. N must be an integer
Write a C++ program that : 1. Allow the user to enter the size of the array such as N. N must be an integer > 1 or 0 to quit the program . 2. Create a vector array of size N x N and populate it with random number of 0s and 1s only. Use a random number generator to generate the 0s and 1s. 3. Display the 2 d vector array. 4. Pass the vector array to a function. The purpose of the to do the following : a. Asks for two integer indices i and j (less or equal to n) or -1 . b. Return the number of nonzero elements of the array that are adjacent to the i-th and j-th element of the array c. repeat steps a and b until -1 is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started