Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
9th Edition
ISBN: 9781337669405
Author: FARRELL
Publisher: Cengage
Bartleby Related Questions 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
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,