View Single Post
Old 10-15-2013, 02:45 PM   #2
dAnceguy117
new hand moves = dab
FFR Simfile AuthorFFR Veteran
 
dAnceguy117's Avatar
 
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
Default Re: Requesting help for programming/ CS majors?

I have nooo experience with C++ sorry, I'm sure someone else will come to the rescue soon. in the meantime

Quote:
int i;
for(int i=0; i<12; i++) name[i] = i;
you can get rid of the second "int" there, you already declared this variable.

for each element in the array, you're storing its number. is that intentional?



sorting the array in alphabetical order manually would be the trickiest part of this assignment by far. do you know if you're allowed to use C++ library functions to do the work for you?

for the frequency of letters, I would make another array with 26 elements. each element in the array should have an int initialized to 0. the 1st element represents 'a', the 2nd represents 'b', etc. as you read in each character from the input, you'll want to compute the 0-25 value based on the character's ASCII value, and then increment (+1) the int stored in that letter's element.

^ ew that's a yucky low-level way of doing it. again, you should find out if you're allowed to use all of the functions available to you.

good luck!
dAnceguy117 is offline   Reply With Quote