Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
OK, so now let's solve it together and basically proceed with the previous solution that we had for
the previous exercise.
Let's open it up.
Take a look at what it has, make some adjustments and hopefully this will work just fine.
So previously we've created file name array of characters, read the file name from the user, opened
these file and basically read all the information created the frequency array that was used to represent
the total amount, the total appearances, the total occurrences of each lowercase letter, how many
time, how many times it appeared in the file itself.
And then after this line, we know that frequency array holds values that we present the number of times
that a certain character and associated character appears in a file.
Now what we need to do is ask the following question at what?
What is the actual character that appears most of the time?
OK, so that's why we will need probably to find the maximum.
So for that, let's create this part.
OK, let's create a max index equals to zero.
So Max index equals to zero will represent the actual index inside a frequency array where the element
has the maximum of appearances.
OK.
So if, for example, we know that lowercase C has the maximum of appearances of, let's say, 10 times,
then Max Index will basically be two because we know that frequency array at index still represents
the total amount of appearances for lowercase C.
OK.
You feel me so far.
Awesome.
So inside in this loop will start this loop from one, right, because we assume that.
The maximum will be at the first index at index zero.
And we will ask the following question if.
Frequency array.
Frequency array at the MAX index so far.
If the total appearances in the Maxine decks so far in the frequency array is last, then the Frequency
Array Index, i.e. in the current index that we are taking a look at.
Then what we will need to do.
What do you think that's the main part?
Maxine Index will be equal to I.
OK.
So every time we will go element by element and ask if the element of this specific index, i.e. if
the value inside of Lisa is greater than the value inside of this array of index Maxine Biggs then update
max index.
That's it.
And the final thing that we need to do is to say, printf, let's see, say, the maximum appearances.
Are of a lower case.
Ease of character, let's say, percentage, see.
Percentage, see, OK.
That's what we do.
And instead of percentage C, we can specify what.
We can specify Max Index plus lower case A.
OK, that's how we get the actual on the actual lowercase letter.
So let's see how it works.
Let's see what will be the answer.
So answer a file name.
What was it?
My file that sixty four so the number the maximum appearances of a lowercase is of character.
Oh, OK.
Let's see.
How many times did it appear?
OK, so let's see.
We want the number of appearances, the number of its appearances, its years is.
And here he is presented and here specify that we need to access frequency.
Array at Index Max Index.
OK, now we are going to see how many times the lower case, oh, in this case was inside of our function,
so let's go like this.
So my file ducked.
So it appeared five times.
Let's make sure of it.
OK, let's make sure of it.
Open folder in File Explorer my file that you see.
So I remember that the lowercase a was four times.
Let's see how many times we have.
Oh, so one, two, three, four and five.
Yeah, probably.
Oh, appears most of the time in this file?
OK, so this is it, guys.
That's how you work with it.
That's how we found.
How many times.
And which of the characters appeared most of the times in our.
Not not the characters, but the lowercase letter, as they appeared most of the time in the file itself.
Of course, we can extend it in support also for uppercase or basically for all of the characters that
we can use in some range, for example.
But that's not for this video, for this video, that should be just enough.
And thank you guys for watching.
Keep on practicing and let's proceed.
OK, you ready?
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.