If i have the following text i need to determine the code used for the frequency analysis using array how to proceed?
afn pli rc imy lcqmfniyk efqjzfiynt pa imy lcaftmrpcfeoy yck pa imy zytiync thrnfo fnx pa imy sfofgd oryt f txfoo lcnysfnkyk dyoopz tlc. pnerircs imrt fi f krtifcqy pa nplsmod crcyid-izp xroorpc xroyt rt fc liiynod
I'd recommend a std::map<std::string, unsigned int> to keep track of how many times each string occurs. I don't think a single array could be suitable for this unless you used std::pair, in which case you're just remaking the std::map anyway.
You can use an array to hold the data. Each character is a number in the range 0-127, most of which you'll never encounter. Printable characters start at 32, which is SPACE.
So you can decare an array of counts. The array must large enough to deal with all characters, that is size 128. And it should start off being initialised with zeros.
Each time you read a character from the file, you use the character as the index into the array and increment that number.
When you've read all data from the file, you can print the array content, that gives you the frequency of the character. As you're not interested in non-printable characters, you can start printing from SPACE, which is 32 (instead of starting from zero).