Hey guys, so my task is to find all the letters in a sentence or sentences. My sentences are :
"
Siandien sviecia saule.
Rytoj tikriausia lis lietus.
"
However, my code, for some reason only calculates the first capital letter and it misses the first R in the second sentence. The code is in my mother language but should be understandable. Bear in mind, at the moment it only suppose to calculate capital letters and the place where the magic happens is at 23rd, 24th, 25th and 26th lines. By the way, I tried if(66 == 'A") and I got result false. So I think that my find function is wrong ?
I do not see your bug. I suspect it is where you use find, but that may be simply because I haven't determined if that part is correct or not.
you are making this harder than it needs to be. I think a whole lot of code above can be boiled down to this (you still need to loop over the getlines and file part, but the letter counter part only is below)
1 2 3 4 5 6 7
int count[256] = {0}; does your language use an 8 bit encoding, though?
for(char& c :sakiniai )
{
count[c]++;
}
for(char i = 'A'; i <= 'Z'; i++)
cout << i << " " << count[i] << endl;