File I/O searching...
Im having trouble with file I/O.
My problem is this, i have a file of formated data like this:
Of course the example above is made up, but the format is the same. Basicly what i am trying to do is take files from a wordlist, store them to a string... then scan all the keys(usally from 1-1000) for common words to narrow the search down. What I dont understand is how i can print what KEY number the word is found it because of the randomness of the output... Any suggestions?
djflkj jsdklfj asjdflkj adslkfjljlajo eoiwj jlifjlk dlksajlkmlkbn lkjdlkjoi oqiwjeoi kjd
This is Plaintext... wow, its great for people to be able to read me ;)
kjldflk alkjsfoi oijf oidsjfoim lkjvl kjaofijowieajfl lkjsfe
PS. the program i am working on is simply a program to expirment brute forcing with the Beufort/Vinger ciphers, turning grilles, and other old crytograhic devices...
If you want a relationship to exist between key number and word (and both are unique), then I suggest using <map>. That's the STL's version of associative arrays. They let you do stuff like
But if the keys are sequential like in your example, then a vector of strings might suffice.
map<int, string> m;
m["the answer"] = 42;