Xiang
03-03-2003, 04:46 PM
Dear sir,
I an trying to write a function to return a nonzero if the character is a vowel, or zero if it is not a vowel. But, my program shown error message, why??? Below are my codes.
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
void isvowel(char string[]);
void main(void)
{
char string[40];
int idx;
clrscr();
gets(string);
printf("%s", string);
isvowel(string);
getch();
}
void isvowel(char string[])
{
int idx;
for (idx=0; string[idx] != '\0'; ++idx)
{ if (isvowel(string[idx]))
putchar("<%c>", string[idx]);
else
putchar("%c", string[idx]);
++idx;
}
getch();
}
This is the actual output I wanted
Washington (input)
W<a>sh<I>ngt<o>n
Thanks
Xiang
I an trying to write a function to return a nonzero if the character is a vowel, or zero if it is not a vowel. But, my program shown error message, why??? Below are my codes.
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
void isvowel(char string[]);
void main(void)
{
char string[40];
int idx;
clrscr();
gets(string);
printf("%s", string);
isvowel(string);
getch();
}
void isvowel(char string[])
{
int idx;
for (idx=0; string[idx] != '\0'; ++idx)
{ if (isvowel(string[idx]))
putchar("<%c>", string[idx]);
else
putchar("%c", string[idx]);
++idx;
}
getch();
}
This is the actual output I wanted
Washington (input)
W<a>sh<I>ngt<o>n
Thanks
Xiang