用Java写、题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。相关知识点: 试题来源: 解析import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;芝士回答,社版权建必究,未元经许可,除不而得转载...
String charVar;// 该变量用来接收输入的字符 System.out.print("请输入任意字符:"); Scanner sc = new Scanner(System.in); int yingwen = 0; int kongge = 0; int shuzi = 0; int qita = 0; charVar = sc.next(); // 取输入的第一个字符 int i = 0; while (i < charVar....
} System.out.println("数字个数:"+num+"\n字母个数:"+letter+"\n空格个数:"+space+"\n其他字符个数:"+other);
import java.util.Scanner;public class test{ public static void main(String[] args) { /**wordCount是存储字母个数,spaceCount是存储空格个数,numberCount是存储数字个数,otherCount存储其它字符个数,temp存放的是字符的ASCII码*/ int wordCount=0,spaceCount=0,numberCount=0,otherCount=0,i=0...
入下列数据∶String charVar;// 该变量用来接收输入的字符 System.out.print("请输入任意字符:"); Scanner sc = new Scanner(System.in); int yingwen = 0; int kongge = 0; int shuzi = 0; int qita = 0; charVar = sc.next(); // 取输入的第一个字符 int i = 0; while (i ...