on-internet
← Community

How to assign unique elements to different indices?

Stack Overflow ·

I've been working on a program that prints out each word, their number of occurrence's and percentage of the number occurrences over total length of the sentence. As you can imagine I had to create a frequency table for each occurrence of each word so I tried many ways to correctly count the occurrences like using rand() to assign each word to a random index but it failed because the function I created to return the random index was inside a for loop so it called itself over and over so when encountered the same word it assinged it to different index and incremented that index instead. When th

Comments

Sign in or sign up to comment and upvote.

No comments yet.