hi, Im new here :)
I want to input a string,
say: abcdaa
so, the program should output:
a
b
c
d
In other words, the program will display each character for only ONCE!!!! And display their frequency.
To avoid the issue of "spoonfeeding", although I would highly appreciate if someone gives me a program about my problem (cause Ive been searching for 3 hours! and this is not my assignment, this is not connected to my subjects right now, I just want to make a very small project)
here is my idea:
user will input a string and such string will be copied into another string variable called "checker".
There will be a loop and each character will be printed, BUT, first, the program will check if the character to be printed is not equals to all elements of the checker string.
I already have the function to count the frequency of each character
GOAL: to make a program that will accept a string and use the HUFFMAN CODING to compress it.
please reply
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
for(x=0; x<string_in.size(); x++)
{
cout<<"\t\t "<<string_in[x]<<endl;
for(y=0; y<string_in.size(); y++)
{
if(checker[y]==string_in[x])
break;
else
checker[x]=string_in[x];
}
}
|
I know this is lame. :3 But I really don't have time to think now, there will be alots of quizzes coming this week, and I really want to finish my program.