0
Program that will read contents of existing text file “data.txt”. count and display the number of alphabets ,vowels and dig
Pls tell how it will.be made
1 Réponse
0
Do you know how to read from the file? If not, then learn how to do that first.
If you do, then you can run through the buffer read from the file, checking each character as you go. You need to include <ctype> header to use the following necessary functions:
- isalpha - Checks whether a character is alphabetical.
- isdigit - Checks whether a character is numerical.
Both functions returns boolean state (as int). So when `isalpha` for example, returns non zero the char is alphabetical, if it returns zero than the char isn't alphabetical. If the char is alphabetical you can then check whether the char was either one of the vowels (disregarding letter case), to count the vowels.
Try and sketch a code from the hint, save and share the link here if you find difficulties. Anyone here can assist further on 👍