WAP to write character into file and display only vowel from file.
Defination :: WAP to write character into file and display only vowel from file.
Source Code::
#include<stdio.h>\\
#include<conio.h>
void main()
{
FILE *f;
char ch;
clrscr();
f=fopen("test.txt","w");
while((ch=getchar())!=EOF)
{
putc(ch,f);
}
fclose(f);
f=fopen("test.txt","r");
while((ch=getc(f))!=EOF)
{
if(ch=='a' || ch=='e'|| ch=='i' || ch=='o'|| ch=='u')
{
printf("%c",ch);
}
}
fclose(f);
getch();
}
Source Code::
#include<stdio.h>\\
#include<conio.h>
void main()
{
FILE *f;
char ch;
clrscr();
f=fopen("test.txt","w");
while((ch=getchar())!=EOF)
{
putc(ch,f);
}
fclose(f);
f=fopen("test.txt","r");
while((ch=getc(f))!=EOF)
{
if(ch=='a' || ch=='e'|| ch=='i' || ch=='o'|| ch=='u')
{
printf("%c",ch);
}
}
fclose(f);
getch();
}
WAP to write character into file and display only vowel from file.
Reviewed by Unknown
on
21:33
Rating:
No comments: