CrazyEngineers
  • abk07
    abk07

    MemberApr 24, 2010

    Character frequency

    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
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • thechamp

    MemberApr 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.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register