import java.io.*; class dentaku { public static void main(String[] args)throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); System.out.print("式を入力"); String input = r.readLine(); String sum[] = new String[input.length()]; String number = ""; int s = 0; int goukei =0; char enzan = ' '; for(int i=0; i < input.length(); i++) { //System.out.print(str[i]); //文字列から1文字ずつ抽出 char num = input.charAt(i); if(i == input.length()-1) { sum[s] = number; } else { if(num == '+' || num == '-'|| num == '*'|| num == '/') { //配列sumに代入 sum[s] = number; s++; sum[s] = String.valueOf(num); s++; } else { //変数numberにnumを代入 number = number + num; } } } for(int j=0; j
↧