6 936 3 123 2 4 write a method that takes an array of boolean values and returns a reference to an integer array of all element indexes that have the value of true in the argument array Here is the method header static int [] trueElements(bool[] b) // returns an array with the positions (indexes) of where true elements are in the array b bool [] myBoo = {true, false, false, true, false, false, true}; int[] result = trueElements (myBoo); for (int i = 0; i < result.Length; i++) Console.WriteLine(result[i]); If your method is correct, the the console should show the following values Microsoft Visual Studio Debug Console

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter6: Using Arrays
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

Has to be done in C#

6
936
3
123
2
4
write a
method that takes an array of boolean values and
returns a reference to an integer array of all element
indexes that have the value of true in the argument
array
Here is the method header
static int [] trueElements(bool[] b) // returns an
array with the positions (indexes) of where true
elements are in the array b
bool [] myBoo =
{true, false, false, true, false, false, true};
int[] result = trueElements (myBoo);
for (int i = 0; i < result.Length; i++)
Console.WriteLine(result[i]);
If your method is correct, the the console
should show the following values
Microsoft Visual Studio Debug Console
Transcribed Image Text:6 936 3 123 2 4 write a method that takes an array of boolean values and returns a reference to an integer array of all element indexes that have the value of true in the argument array Here is the method header static int [] trueElements(bool[] b) // returns an array with the positions (indexes) of where true elements are in the array b bool [] myBoo = {true, false, false, true, false, false, true}; int[] result = trueElements (myBoo); for (int i = 0; i < result.Length; i++) Console.WriteLine(result[i]); If your method is correct, the the console should show the following values Microsoft Visual Studio Debug Console
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage