輸入一行字符,分別統計出其中英文字母、空格、數字和其他字符
//alphabet 英文字母 ,blank 空格,數字 digit#include <stdio.h>int main(){ char c; int alphabet=0,blank=0,digit=0,other=0; printf("請輸入一行字符:\n ...
//alphabet 英文字母 ,blank 空格,數字 digit#include <stdio.h>int main(){ char c; int alphabet=0,blank=0,digit=0,other=0; printf("請輸入一行字符:\n ...
public class CaculateCharCount { /** * @description 輸入一行字符,分別統計出其中英文字母、空格、數字和其它字符的個數。 * @param args */ public static void main(String ...
一、參考解法: 1 2 ...
public static void main(String[] args) { //輸入一行字符,分別統計出其中英文字母、空格、數字和其它字符的個數。 String str="ABab哈哈 123,"; int letter=0;//字母 int space=0;//空格 int number ...
題目:輸入一行字符,分別統計出其中英文字母、空格、數字和其它字符的個數。 程序分析:利用while語句,條件為輸入的字符不為 '\n '. ...
getchar()函數的作用是從計算機終端(一般為鍵盤)獲取一個無符號字符。getchar()函數只能接收一個字符,其函數值就是從輸入設備獲取到的字符。 該函數聲明在stdio.h頭文件中,使用的時候要包含stdio.h頭文件。 如: #include<stdio.h> ...