Character frequency

abk07
@abk07-S8b6tD โ€ข Oct 26, 2024

Hi! I'm trying to write a C++ program which finds the character frequency in a given string..
Can anyone please help me out???
Check this out for complete description about the program..
And this is my first post and I'm new to this, if I've posted in the wrong section please let me know..

[โ€‹IMG]

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • thechamp

    @thechamp-p64ZA1 • Apr 24, 2010

    int freq[26]={0},i;
    int len=strlen(string);
    for(i=0;i<len;i++)
    freq[(string)-65]++;

    for(i=0;i<26;i++) {
    if(freq)
    cout<<char(i+65)<<" "<<freq;
    }



    i have not compiled this program so there might be errors. try to understand the algorithm.