forked from Ayush-chhabra/Hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF10.CPP
More file actions
101 lines (66 loc) · 1.42 KB
/
F10.CPP
File metadata and controls
101 lines (66 loc) · 1.42 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<stdio.h>
#include<ctype.h>
#include<process.h>
void main()
{
clrscr();
int ch;
char word[100],choice,wordin[10],wordout[10],main='y';
ifstream fin;
ofstream fout;
do
{
cout<<endl<<"1. To create a text file"<<endl
<<"2. Word starting with vowels"<<endl
<<"3. Exit"<<endl<<endl
<<" Enter choice : ";
cin>>ch;
switch(ch)
{
case 1 :
fout.open("text.txt");
do
{
cout<<endl<<"Enter line : ";
cin.get();
cin.getline(word,100,'\n');
fout<<word<<"\n";
cout<<endl<<"Do you want to add more line (y/n) : ";
cin>>choice;
}while(tolower(choice)=='y');
fout.close();
break;
case 2 :
fin.open("text.txt");
fout.open("text2.txt");
while(!fin.eof())
{
fin>>word;
char x=tolower(word[0]);
if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u')
fout<<word<<" ";
}
fin.close();
fout.close();
fin.open("text2.txt");
cout<<endl;
cout<<"The words stored in files are : ";
while(!fin.eof())
{
fin>>word;
cout<<word<<" ";
}
cout<<endl;
fin.close();
break;
case 3 : exit(0);
default : cerr<<"Error";
exit(0);
}
cout<<endl<< "Do you want to do more (y/n) : ";
cin>>main;
}while(tolower(main)=='y');
getch(); }