### Referencing a Matrix within a String

Let me start by saying, I've been on a two-year hiatus from C++(my knowledge of C++ was pretty lacking before the break), so please tell me how wrong anything I'm about to post is.

So, I decided to get back in to programming with the spare time I have these days, and I though my first project would be a scale finder for my own musical reference.

Before I took to the keyboard, I thought I'd plan my program out a little bit.

My plan is to create a matrix for all the notes, where:
[0]=C, [1]=C#, [2]=D, etc., etc,.

Then, create a function that shows certain values from the matrix, based on which scale is called for, i.e.: Scale C is requested, and the console outputs the data
[0], [2], [4], [5], [7], [9], [11], [0]

So I guess my questions are:
1) Can I create strings that hold values from a matrix, and

Thanks in advance all for the help, and patience, with my lack of knowledge and experience.
 My plan is to create a matrix for all the notes, where: [0]=C, [1]=C#, [2]=D, etc., etc,.

A matrix is a data structure that data that requires a combination of two indexes for access. What you're presenting looks like a map (associative array) that maps an integer to a string. Noticing that what you're mapping are contiguous integers (0...11, I assume), this can even be represented as a simple vector of 12 strings.

 create a function that ... Scale C is requested, and the console outputs the data [0], [2], [4], [5], [7], [9], [11], [0]

Are you going to calculate it every time or just hold a table of all scales?

Either way, yes, it's certainly possible.

 Can I create strings that hold values from a matrix, and

Sure, since your data structure is already holding strings ("C#" for example), you can concatenate them, with some spaces inbetween.
I'd like to calculate every time, as I want to add more scales and variations as I get the program flowing. I suppose I could just create a table holding all the scales, but that doesn't seem like much of a workout(lol).

I see what you're saying though, I think. I should be using an array instead of a matrix, since I only need a single row of values, not multiple rows and columns, correct?

Thanks for the speedy reply by the way. I didn't expect an answer that quickly.
Topic archived. No new replies allowed.