我做了一個擺動計算器作爲我做的功課的一部分,並且特別希望繼續減法的一些建議。隨着繼續加起來,它足夠直接了(i.o.w。添加操作數,然後從那裏繼續添加)。這就是我所做的。關於繼續減法
if(totalCount > 1)
{
if(sbOne.length() > 0)
{
operandOne = Double.parseDouble(sbOne.toString());
}
else
{
operandOne = 0;
}
if(sbTwo.length() > 0)
{
operandTwo = Double.parseDouble(sbTwo.toString());
}
else
{
operandTwo = 0;
}
result = operandOne + operandTwo;
totalResult += result;
screenResult = Double.toString(totalResult);
txtDisplay.setText(screenResult);
notCalculate = true;
sbOne.setLength(0);
sbTwo.setLength(0);
我如何能實現從另一箇中減去一個操作數,然後繼續從那裏起減去相同的結果。
你的意思是像'totalResult - =結果;'? – 2012-01-17 19:43:34
不完全確定你在這裏問什麼..短的^ – Alex 2012-01-17 19:46:59
相同的評論亞歷克斯 – 2012-01-17 20:05:32