<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. C語言

    C語言實驗:保留字母

    時間:2025-04-15 02:54:57 C語言 我要投稿
    • 相關推薦

    C語言實驗:保留字母

      C語言的設計目標是提供一種能以簡易的方式編譯、處理低級存儲器、產生少量的機器碼以及不需要任何運行環境支持便能運行的編程語言。下面我們來看看C語言實驗——保留字母

      Problem Description

      編一個程序,輸入一個字符串,將組成字符串的所有非英文字母的字符刪除后輸出。

      Input

      一個字符串,長度不超過80個字符。

      Output

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

      Example Input

    1
    abc123+xyz.5          

      Example Output

    1
    abcxyz          

      Hint

      Author

      ZJGSU

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    import java.util.Scanner;          
    public class Main {          
       public static void main(String[] args) {          
           Scanner sc = new Scanner(System.in);          
           String str = sc.next();//數組用法          
           char[] ch = new char[1010];          
           int i, j;          
           for (i = 0; i < str.length(); i++) {          
               ch[i] = str.charAt(i);//獲取str1中的第i個字符          
           }          
           for (j = 0; j <= i; j++) {          
               if ((ch[j] >= 'A' && ch[j] <= 'Z') || (ch[j] >= 'a' && ch[j] <= 'z'))          
                   System.out.printf("%c", ch[j]);          
           }          
           System.out.println();          
           sc.close();          
       }          
    }          

    【C語言實驗:保留字母】相關文章:

    C字母開頭的英語短語02-03

    C語言上級實驗報告精選三篇06-21

    2017《C語言》上機實驗題及參考答案05-26

    C語言數據結構中棧操作實驗05-31

    考研英語大綱C字母開頭詞匯04-24

    高考英語必備C字母開頭的短語08-08

    C語言考點08-11

    C語言試題01-23

    C語言的元素02-16

    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人