How would I modify this code appropriately using arrays?
Could you please explain better what you aim to do? Do you want all your "freq*" variables become 'cells' of an array?
If yes, may I suggest you a struct, instead? Unless, of course, you don't need an array for a specific purpose.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.
I think you may have missed the closing [/code] tag.
I think this might be what you want. See how it differs from your program. I have some comments on what I added.