Compare commits

..

No commits in common. 'main' and 'master' have entirely different histories.
main ... master

@ -1,2 +0,0 @@
# jisuanqi

@ -1,4 +0,0 @@
public class Test {
}

@ -26,7 +26,7 @@
width: 100%;
height: 50px;
margin-bottom: 10px;
padding: 0px;
padding: 10px;
font-size: 24px;
text-align: right;
border: none;
@ -61,7 +61,7 @@
</style>
</head>
<body>
<div class="calculator">
<div class="calculator">
<input type="text" id="display" disabled>
<div class="buttons">
<button onclick="clearDisplay()">C</button>
@ -81,12 +81,10 @@
<button onclick="appendNumber('.')">.</button>
<button onclick="compute()">=</button>
<button onclick="chooseOperation('+')">+</button>
<button onclick="chooseOperation('%')">%</button>
<button onclick="appendNumber('-')">±</button>
</div>
</div>
</div>
<script>
<script>
let currentOperand = '';
let previousOperand = '';
let operation = undefined;
@ -95,7 +93,6 @@
function appendNumber(number) {
if (number === '.' && currentOperand.includes('.')) return;
if (number === '-' && currentOperand.length > 0) return; // 防止在数字中间添加负号
currentOperand += number;
updateDisplay();
}
@ -128,9 +125,6 @@
case '/':
computation = prev / current;
break;
case '%':
computation = prev % current;
break;
default:
return;
}
@ -150,6 +144,6 @@
function updateDisplay() {
display.value = currentOperand;
}
</script>
</script>
</body>
</html>
Loading…
Cancel
Save