+ 1

Anyone can please help me to understand this program in the line of twenty until thirty two

https://code.sololearn.com/cSaj9KcADkCz/?ref=app

31st Dec 2017, 2:37 PM
Kevin Wijaya
Kevin Wijaya - avatar
3 Réponses
+ 2
You have three variables that counts the words, or spaces or other symbols. Then the firsts lines count if the symbol is a word, between uppercases "A" to "Z" or lowercases "a" to "z". The next part count normal spaces and \t, i don't know what is that jejej, maybe a jumpline or another form to write space. And the last part count other symbols that don't are above mentioned.
31st Dec 2017, 2:49 PM
Sebastián Zapata
Sebastián Zapata - avatar
+ 2
Let me help... You know, system understands only numbers (0 n 1 to be exact), therefore every character like A,B,C... and spaces and symbols like comma (,) fullstop (.) are stored in memory with different Unicodes (ASCII codes). For eg, A is 65, B is 66, space is 32. (small n capital letters have different unicodes, therefore treated as different characters). Thats why, in line 20, the part " ch>='A' ", the single quotes on A signifies to it's unicode i.e., 65. So, that if statement is saying... if the value of character is between 65 to 91 or (unicodes of small letters), then increment the value of variable LETTER with one. Similarly, if value of ch is 32 (i.e., space) or \t (tab, which is abt 4-5 spaces), will increment the value of variable SPACES. And, remaining will be the punctuations, i.e., commas, fullstops, exclamation marks. Resulting the counting of total number of character, spaces and punctuations in the input.👍
31st Dec 2017, 2:55 PM
Harjeet Singh
Harjeet Singh - avatar
+ 1
I'm very helpful, Thanks for your answer
31st Dec 2017, 3:15 PM
Kevin Wijaya
Kevin Wijaya - avatar