C语言实验——保留字母 (sdut oj)

    xiaoxiao2021-03-26  67

    C语言实验——保留字母

    Time Limit: 1000MS  Memory Limit: 65536KB

    Problem Description

    编一个程序,输入一个字符串,将组成字符串的所有非英文字母的字符删除后输出。

    Input

    一个字符串,长度不超过80个字符。

    Output

    删掉非英文字母后的字符串。

    Example Input

    abc123+xyz.5

    Example Output

    abcxyz

    Hint

    Author

    ZJGSU

    参考代码

    #include<stdio.h> #include<string.h> int main() { char a[81]; gets(a); int i; for(i = 0; i < strlen(a); i++) { if(a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z') printf("%c",a[i]); } return 0; }
    转载请注明原文地址: https://ju.6miu.com/read-650082.html

    最新回复(0)