Originally Posted by
quzah
I have lots of ideas. But then, I don't actually care about finishing this program and getting a grade for it. So, what are your ideas?
Quzah.
Sorry I forgot to put what I have done by now:
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;
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++)
{
if (str[i] == strv[i])
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
printf("\n");
printf("Play Again? ");
getchar();
repeat = getchar();
while ( getchar() != '\n');
} while(repeat == 'Y' || repeat == 'y');
return EXIT_SUCCESS;
}
With this code, it works sometimes, but not always and is only vowels.
NOTE:It looks like the problem is where I marked, probably I'm not really writing the correct way the if statement.