I am writing, or trying to start writing, a program that would allow the user to input any number of lines. Using arrays, the program should count each letter of input up until a '.' is reached, and then reorganize the list in order of frequency of each letter. I think that I should be able to do most of this, with a bit of a struggle I am sure, but I can figure it out. However, I do not understand one sentence of the assignment:
This is probably intended to be a hint, though it seems obvious that I would need to hold both the letter and an integer. How else could I keep track of the frequency of use by each letter? So, what is the problem? Well, my book has very little on structs, and the online lessons (it is an online class through the nearby junior college) have nothing on structs. I generally learn best by seeing examples, but in this case I have none from which to learn. Can someone give/show me an example and an explanation? I would appreciate it, as I put this assignment off a bit longer than intended, and at this point only have 24 hours in which to complete it.
[Forgot to mention that I am not to use classes, and this is a single-dimensional array. I don't know if the last detail is relevant, but two-dimensional arrays happen to be the next lesson, so I wouldn't know at this point]
Use an array with a struct type as its base type so that each array element can hold both a letter and an integer.
This is probably intended to be a hint, though it seems obvious that I would need to hold both the letter and an integer. How else could I keep track of the frequency of use by each letter? So, what is the problem? Well, my book has very little on structs, and the online lessons (it is an online class through the nearby junior college) have nothing on structs. I generally learn best by seeing examples, but in this case I have none from which to learn. Can someone give/show me an example and an explanation? I would appreciate it, as I put this assignment off a bit longer than intended, and at this point only have 24 hours in which to complete it.
[Forgot to mention that I am not to use classes, and this is a single-dimensional array. I don't know if the last detail is relevant, but two-dimensional arrays happen to be the next lesson, so I wouldn't know at this point]