I am not sure your numbers version works like you think it does. You read in
h
in
nuskaityk()
and then overwrite it immediately in
ska()
. Also, your sort function (I think that's what
rikiuok
is) seems to be a bubble sort that is missing its nested loop. The array will not be completely sorted when you are done--only the largest value is guaranteed to be in its proper location.
... but now im stuck with words |
That is a pretty broad statement. I don't know what it is you are stuck with.
You can compare the first letter of two strings with
if (string1[0] == string2[0])
. You can compare alphabetical order of two strings with
if (string1 < string2)
.
By the way, it is safer and more flexible to use std::vector than a raw array. How do you know you only need 36 elements? And what happens if you read in 37? Using a std::vector protects you from this.
In either event, there are std::sort functions you can use to do the sorting for you.