Here is the working code:
Code:
#include <stdio.h>
#include <stdlib.h>
#include "arrayv.h"
/* This function will find the number of vowels in the word and output their position using a * to
mark the vowels position. */
int arrayv()
{
int i, j, flag;
char strv[11] = {'a','e','i','o','u','A','E','I','O','U','\0'};
char str[100], repeat;
printf("Number of vowels in a word:\n");
do{
printf("\n");
printf("Please enter a word: ");
scanf("%s", str);
printf("\n");
printf("%s\n", str);
for(i=0; str[i] != '\0'; i++)
{ flag = 0;
for(j=0; strv[j] != '\0'; j++)
{
if (str[i] == strv[j])
{
printf("*");
flag = 1;
break;
}
}
if (flag == 0)
{
printf(" ");
}
}
printf("\n");
printf("\n");
printf("Play Again? ");
getchar();
repeat = getchar();
while ( getchar() != '\n');
} while(repeat == 'Y' || repeat == 'y');
return EXIT_SUCCESS;
}