int tenpuzzle(int n){ // 0000から9999までくりかえす for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { // i:計算順序 j,k,l:四則演算選択 keisan retu = keisan(n, a, b, c, d); for (int i = 0; i < 5; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { retu.dousyutu(i, j, k, l); } } } } retu.countsyori(); } } } } return count; }
void check_mojiretu(char mojiretu[]){ int moji_i = 0, num = 0; double kekka; double kazu[100] = {0}; int hugou[100] = {0}; int mainasu = 1; int hugou_i = 0; //文字列を数字と記号に分ける for ( moji_i = 0; mojiretu[moji_i] != '\0'; moji_i++, mainasu = 1){ if(mojiretu[moji_i] <= '9' && mojiretu[moji_i] >= '0' || mojiretu[moji_i] == '(' || mojiretu[moji_i] == '.'){ //正負読み込み moji_i = check_seihu(mojiretu, kazu, num, &mainasu ,moji_i); //整数読み込み moji_i = check_seisuu(mojiretu, kazu, num, moji_i); //小数点以下読み込み moji_i = check_syousuu(mojiretu, kazu, num, moji_i); kazu[num] *= mainasu; num++; } hugou_i = check_hugou(mojiretu, hugou, moji_i, hugou_i); } //計算 printf("→ %g\n",keisan(kazu, hugou)); }