heres the full code for the program:
CODE
#include <string.h>
#include <stdio.h>
#define MAX 225
int count_char(int n, char a[]);
int count_words(int n, char a[]);
int count_vowels(int n, char a[]);
int main(void)
{
char line [MAX];
int a, b, c;
printf("Input a line of text: ");
gets(line);
a = count_char(a, line);
b = count_words(b, line);
c = count_vowels(c, line);
printf("\nThere are %d characters, %d words, and %d vowels in the line.", a, b, c);
return 0;
}
int count_char(int n, char a[])
{
n= strlen(a);
return n;
}
int count_words(int n, char a[])
{
char* token;
n=0;
token = strtok(a, " ");
while(token != NULL)
{
n++;
token = strtok(NULL, " ");
}
return n;
}
int count_vowels(int n, char a[])
{
char vowels[] = "aeiouAEIOU";
int i, j;
n = 0;
for(i = 0; vowels[i] != NULL; i++)
for (j = 0; vowels[j] != NULL; j++)
if(vowels[j] == a[i])
{
n++;
break;
}
return n;
}