Quiz 3 – Counting letters

This was the third quiz of the partial

For this the user had to input a sentence, which the program has to read and say how many of one letter does the sentence has, in this case the letter «o».

quiz3

For saving all the sentence we needed to put getline(cin,name) (so it can read the whole line and not just the first word). this is part of the string function. the letter we search for was a char and we also got a function in which we are counting the number of times the letter appears.

Deja un comentario

Crea un blog o un sitio web gratuitos con WordPress.com.

Subir ↑