Project Book Cipher Suggestions?

I've been working on a project the last few days. The program reads a txt file, stores each character in a multimap, and pairs with a number, that increments from 0 each time it reads a character into the map..(ex first letter a=0, second letter d = 1). This ends up being very inefficient once the program is told to read a large text file(I took a .txt version of an actual book and it took up a minute and 33 seconds to input into the mutlimap).

Any suggestions as to how I could make it more efficient?
You're trying to count the number of occurrences of each character in the file? If so, this would be the fastest:

1
2
3
std::vector< unsigned > char_counts( 255, 0 );

++char_counts[ char_just_read ];

Yes, I'm trying to count every character in the text file, and then that number has to be paired with the character for that number. I find the multimap works well because I just input the character and pair it with the number and then increment that number.

How would I pair it up with the character if I did it like that?
Topic archived. No new replies allowed.