tags:

views:

102

answers:

2

Hi, 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?

A: 

Create a for or foreach loop that goes through each array element. When the value of interest is found, you play the note.

JYelton
A: 

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
    }
}
Neil N
He's doing chars because there's more than just integer possibilities. Other note styles (staccato, false harmonics, slide) will require values other than the typical integers for indicating fret location.
Jason M
@Jason M: then ideally, he should be using an enum to handle all possible values.
Neil N
the array contains dashes, like a guitar tab, a dash is a pause and a number is a note
i'm done guys thanks for the help, the for loop worked. this makes a greatsummative project for grade 11 computer science, if someone want it i will send it to them