c语言程序相关的问题

写一个程序 第一个字母大写 然后把语句中的元音字母(a,e,i,o,u)去掉 并且以CTRL+D结尾
不能用scanf,fgets,数组
需要使用getchar putchar
这是我的代码
但是不能以ctrl+D结尾 能帮我看看怎么修改吗?

 #include <stdio.h>
#include <ctype.h>
int is_vowel(int character) {
    if (character == 'a' || character == 'e' ||
        character == 'i' || character == 'o' ||
            character == 'u') {
        return 1;
    }
    return 0;
}
 
int main(void) {
    int c;
    while(1) {
    while( (c=getchar()) != EOF){
        if (is_vowel(c) == 0) { 
           putchar(c);       
       }
    }   putchar('\n');
} 
}

外层while(1) 循环多余:

#include <stdio.h>
#include <ctype.h>
int is_vowel(int character) {
    if (character == 'a' || character == 'e' ||
        character == 'i' || character == 'o' ||
        character == 'u') {
        return 1;
    }
    return 0;
}

int main(void) {
    int c;
    //while (1) {
        while ((c = getchar()) != EOF) {
            if (is_vowel(c) == 0) {
                putchar(c);
            }
        }   putchar('\n');
    //}
        return 0;
}

ctrl+D的ascll码为4
25,26行改成这样

while( (c=getchar()) != 4){
        if (is_vowel(c) == 0&&is_vowel(c+32)==0) {