Académique Documents
Professionnel Documents
Culture Documents
h>
#include <fstream.h>
#include <conio.h>
#include <process.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void main()
char sent[80],cho='y';
int n,c,i;
int a=0,b=0,A=0,B=0,sc=0,w=0,dig=0,count=0;
ofstream ofile("text1.txt");
if(!ofile)
cout<<"Problems";
exit(0);
ifstream ifile("text1.txt");
if(!ifile)
exit(0);
do
{ clrscr();
gotoxy(10,5);
cout<<"MENU";
gotoxy(10,6);
cout<<"1. Input";
gotoxy(10,7);
cout<<"2. Display";
gotoxy(10,8);
cout<<"3. End";
gotoxy(10,10);
cin>>c;
switch (c)
case 1:
clrscr();
cout<<"Number of sentences";
cin>>n;
clrscr();
for( i=1;i<=n;i++)
gets(sent);
ofile.write(sent,strlen(sent));
ofile.close();
cin>>cho;
break;
case 2:
char ch;
while(ifile)
ifile.get(ch);
if(isupper(ch)!=0)
{
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
A++;
else
B++;
else if(islower(ch)!=0)
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
a++;
else
b++;
else if(isdigit(ch)!=0)
dig++;
w++;
else if(ch=='.')
w++;
else
sc++;
ifile.close();
clrscr();
cout<<"Numbers: "<<dig<<"\n";
cout<<"Words: "<<w<<"\n";
cin>>cho;
break;
case 3:
clrscr();
cout<<"THANK YOU";
exit(0);
}while(cho=='y');
clrscr();
cout<<"THANK YOU";