-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment-12.cpp
More file actions
37 lines (36 loc) · 825 Bytes
/
Copy pathassignment-12.cpp
File metadata and controls
37 lines (36 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main()
{
int vowel=0,space=0,character=0,line=0;
string str;
char ch;
ofstream fout("data.txt");
cout<<"Give input :\n";
do
{
getline(cin,str);
fout<<str<<endl;
}while(str.length()>0);
fout.close();
ifstream fin("data.txt");
cout<<"The data in file is :\n";
while(!fin.eof())
{
fin.get(ch);
cout<<ch;
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
vowel++;
if(ch==' ')
space++;
if((int(ch)>=65 && int(ch)<=90) || (int(ch)>=97 && int(ch)<=122))
character++;
if(ch=='\n')
line++;
}
cout<<"The Data has :\n";
cout<<"Vowels : "<<vowel<<endl<<"spaces : "<<space<<endl<<"characters : "<<character<<endl<<"lines : "<<(line-2)<<endl;
return 0;
}