SlideShare a Scribd company logo
1 of 1
Download to read offline
5. Vowels The text file “vowels.txt” contains a paragraph of text. It has words in mixed upper
and lower case. Write a C++ program that reads this file and counts the number of digits, vowels,
and remaining characters that are not in the alphabet set [A..Z]. Show the output on the screen.
Solution
#include
#include
#include
using namespace std;
int main() {
ifstream fin;
fin.open("vowels.txt", ios::in);
char ch;
int digit = 0,vowel=0,non=0;
while (!fin.eof() ) {
fin.get(ch);
if (isdigit(ch)){
++digit;
}
else
if(ch=='A'||ch=='a'||ch=='e'||ch=='E'||ch=='i'||ch=='I'||ch=='o'||ch=='O'||ch=='u'||ch=='
U')
{
++vowel;
}
else
++non;
}
cout <<"no of digits :"<

More Related Content

More from kellenaowardstrigl34

Stuck on hw problem Assume that the forces acting on a mass are such.pdf
Stuck on hw problem Assume that the forces acting on a mass are such.pdfStuck on hw problem Assume that the forces acting on a mass are such.pdf
Stuck on hw problem Assume that the forces acting on a mass are such.pdf
kellenaowardstrigl34
 
In java languageWhich of the following is falseA) A JPasswordFi.pdf
In java languageWhich of the following is falseA) A JPasswordFi.pdfIn java languageWhich of the following is falseA) A JPasswordFi.pdf
In java languageWhich of the following is falseA) A JPasswordFi.pdf
kellenaowardstrigl34
 
I want you to go the Next Generation Sunshine State standards (http.pdf
I want you to go the Next Generation Sunshine State standards (http.pdfI want you to go the Next Generation Sunshine State standards (http.pdf
I want you to go the Next Generation Sunshine State standards (http.pdf
kellenaowardstrigl34
 
How are macromolecules transported across the nuclear envelope Desc.pdf
How are macromolecules transported across the nuclear envelope Desc.pdfHow are macromolecules transported across the nuclear envelope Desc.pdf
How are macromolecules transported across the nuclear envelope Desc.pdf
kellenaowardstrigl34
 
GeneticsBackground info About 30 of the Irish population has red.pdf
GeneticsBackground info About 30 of the Irish population has red.pdfGeneticsBackground info About 30 of the Irish population has red.pdf
GeneticsBackground info About 30 of the Irish population has red.pdf
kellenaowardstrigl34
 
Describe the repair mechanisms used during DNA replication.Soluti.pdf
Describe the repair mechanisms used during DNA replication.Soluti.pdfDescribe the repair mechanisms used during DNA replication.Soluti.pdf
Describe the repair mechanisms used during DNA replication.Soluti.pdf
kellenaowardstrigl34
 
Describe the current state of the human beta globin gene family and .pdf
Describe the current state of the human beta globin gene family and .pdfDescribe the current state of the human beta globin gene family and .pdf
Describe the current state of the human beta globin gene family and .pdf
kellenaowardstrigl34
 

More from kellenaowardstrigl34 (20)

The portion of the fungus that projects above the substrate and conta.pdf
The portion of the fungus that projects above the substrate and conta.pdfThe portion of the fungus that projects above the substrate and conta.pdf
The portion of the fungus that projects above the substrate and conta.pdf
 
the appearance of symptoms of a genetic disorder at earlier ages in .pdf
the appearance of symptoms of a genetic disorder at earlier ages in .pdfthe appearance of symptoms of a genetic disorder at earlier ages in .pdf
the appearance of symptoms of a genetic disorder at earlier ages in .pdf
 
Stuck on hw problem Assume that the forces acting on a mass are such.pdf
Stuck on hw problem Assume that the forces acting on a mass are such.pdfStuck on hw problem Assume that the forces acting on a mass are such.pdf
Stuck on hw problem Assume that the forces acting on a mass are such.pdf
 
Some Giant Sulphur Bacteria are so large as to be visible to the nak.pdf
Some Giant Sulphur Bacteria are so large as to be visible to the nak.pdfSome Giant Sulphur Bacteria are so large as to be visible to the nak.pdf
Some Giant Sulphur Bacteria are so large as to be visible to the nak.pdf
 
right now I am using a l293d chip to control my DC motor which is 6 .pdf
right now I am using a l293d chip to control my DC motor which is 6 .pdfright now I am using a l293d chip to control my DC motor which is 6 .pdf
right now I am using a l293d chip to control my DC motor which is 6 .pdf
 
Problem 1 Eclipses and occults Saturn has five satellites that rotat.pdf
Problem 1 Eclipses and occults Saturn has five satellites that rotat.pdfProblem 1 Eclipses and occults Saturn has five satellites that rotat.pdf
Problem 1 Eclipses and occults Saturn has five satellites that rotat.pdf
 
please show work A hospital reports that two patients have been admi.pdf
please show work A hospital reports that two patients have been admi.pdfplease show work A hospital reports that two patients have been admi.pdf
please show work A hospital reports that two patients have been admi.pdf
 
Person.java is givenSolutionSince I didnt have the implement.pdf
Person.java is givenSolutionSince I didnt have the implement.pdfPerson.java is givenSolutionSince I didnt have the implement.pdf
Person.java is givenSolutionSince I didnt have the implement.pdf
 
In java languageWhich of the following is falseA) A JPasswordFi.pdf
In java languageWhich of the following is falseA) A JPasswordFi.pdfIn java languageWhich of the following is falseA) A JPasswordFi.pdf
In java languageWhich of the following is falseA) A JPasswordFi.pdf
 
in a completely randomized (one-way) anova, with other things being .pdf
in a completely randomized (one-way) anova, with other things being .pdfin a completely randomized (one-way) anova, with other things being .pdf
in a completely randomized (one-way) anova, with other things being .pdf
 
I want you to go the Next Generation Sunshine State standards (http.pdf
I want you to go the Next Generation Sunshine State standards (http.pdfI want you to go the Next Generation Sunshine State standards (http.pdf
I want you to go the Next Generation Sunshine State standards (http.pdf
 
How are macromolecules transported across the nuclear envelope Desc.pdf
How are macromolecules transported across the nuclear envelope Desc.pdfHow are macromolecules transported across the nuclear envelope Desc.pdf
How are macromolecules transported across the nuclear envelope Desc.pdf
 
GeneticsBackground info About 30 of the Irish population has red.pdf
GeneticsBackground info About 30 of the Irish population has red.pdfGeneticsBackground info About 30 of the Irish population has red.pdf
GeneticsBackground info About 30 of the Irish population has red.pdf
 
Fishes are at the base of the vertebrate Tree of Life and fishes do .pdf
Fishes are at the base of the vertebrate Tree of Life and fishes do .pdfFishes are at the base of the vertebrate Tree of Life and fishes do .pdf
Fishes are at the base of the vertebrate Tree of Life and fishes do .pdf
 
Consider two point sources separated by a distance of 10 meters. The .pdf
Consider two point sources separated by a distance of 10 meters. The .pdfConsider two point sources separated by a distance of 10 meters. The .pdf
Consider two point sources separated by a distance of 10 meters. The .pdf
 
Consider the following system microprocessor based system Program t.pdf
Consider the following system microprocessor based system  Program t.pdfConsider the following system microprocessor based system  Program t.pdf
Consider the following system microprocessor based system Program t.pdf
 
Develop an algorithm for the 4-sum problem.SolutionThe algorit.pdf
Develop an algorithm for the 4-sum problem.SolutionThe algorit.pdfDevelop an algorithm for the 4-sum problem.SolutionThe algorit.pdf
Develop an algorithm for the 4-sum problem.SolutionThe algorit.pdf
 
Describe the repair mechanisms used during DNA replication.Soluti.pdf
Describe the repair mechanisms used during DNA replication.Soluti.pdfDescribe the repair mechanisms used during DNA replication.Soluti.pdf
Describe the repair mechanisms used during DNA replication.Soluti.pdf
 
Describe the current state of the human beta globin gene family and .pdf
Describe the current state of the human beta globin gene family and .pdfDescribe the current state of the human beta globin gene family and .pdf
Describe the current state of the human beta globin gene family and .pdf
 
Derived characteristics that define the order Primate include    a.pdf
Derived characteristics that define the order Primate include    a.pdfDerived characteristics that define the order Primate include    a.pdf
Derived characteristics that define the order Primate include    a.pdf
 

Recently uploaded

SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 

Recently uploaded (20)

Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 

5. Vowels The text file “vowels.txt” contains a paragraph of text. I.pdf

  • 1. 5. Vowels The text file “vowels.txt” contains a paragraph of text. It has words in mixed upper and lower case. Write a C++ program that reads this file and counts the number of digits, vowels, and remaining characters that are not in the alphabet set [A..Z]. Show the output on the screen. Solution #include #include #include using namespace std; int main() { ifstream fin; fin.open("vowels.txt", ios::in); char ch; int digit = 0,vowel=0,non=0; while (!fin.eof() ) { fin.get(ch); if (isdigit(ch)){ ++digit; } else if(ch=='A'||ch=='a'||ch=='e'||ch=='E'||ch=='i'||ch=='I'||ch=='o'||ch=='O'||ch=='u'||ch==' U') { ++vowel; } else ++non; } cout <<"no of digits :"<