Program that will read contents of existing text file “data.txt”. count and display the number of alphabets ,vowels and dig | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

19th Jan 2020, 7:16 AM
Gautam Pancholi
1 Answer
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 👍
19th Jan 2020, 8:17 AM
Ipang