Make a 2D char array scan every column for an integer value in C#
i'm trying to make a program that will scan each column of a guitar tab and play a note when it detects a number. I will do this by creating a char array and have the program scan each collumn of an int value. is this possible? if so开发者_开发知识库, how do i do it?
Create a for
or foreach
loop that goes through each array element. When the value of interest is found, you play the note.
What will the array contain BESIDES integers? Blanks?
If nothing else, just use an int array to begin with, avoid casting from char. the "No Sound" value could be 0, or -1
But to loop through a 2D array, you would just use a nested for loop
for(int row = 0; rows > rowCount; row++)
{
for(int column = 0; column > columnCount; column ++)
{
note = yourArray[row][colum];
// do something with the note
}
}
精彩评论