#include <stdio.h>
struct name
{
char str[100];
};
int main()
{
struct name n[3];
int i,j=0;
int count=0;
int array[100];
FILE *fp,*fp1; ///File type pointer
///scan massage from a text
fp=fopen("input.txt","r");
for(i=0; i<3; i++)
{
fscanf(fp,"%s",n[i].str);
}
fclose(fp);
///finding vowel
for(j=0; j<3; j++)
{
i=0;
count=0;
while(n[j].str[i]!='�')
{
if(n[j].str[i]=='a' || n[j].str[i]=='e' || n[j].str[i]=='i'|| n[j].str[i]=='o' || n[j].str[i]=='u' )
{
count++;
}
i++;
}
array[j]=count;
}
///print output in text file
fp1=fopen("output.txt","w");
for(i=0; i<3; i++)
{
fprintf(fp,"%d",array[i]);
}
fclose(fp1);
return 0;
}
Output
1st Step:
Create a text file and save massage(don't use space)
2nd Step:
Run the Program.
Add your comment