What is the correct generic name for the data structure in a calculator app that holds the numeric display
It would hold a string and have characters (numeric, or decimal point) added and removed from the right end. Ignore the case of negative numbers for simplicity.
Does this kind of data structure have an agreed-upon name? Register? Buffer? Display? Something else?
UPDATE: This is an internal representation and may not be the final form of some calculation. It may be the inputs to some later calculation (after turning it into 开发者_JS百科a number, of course).
You could implement it using a stack. A stack is last-in-first-out (LIFO), just like what you're describing with the display.
But if you're looking for something to name your calculation results, I'd agree with most of the answers that said "result" or "display". :-P
I wouldn't say there's an "agreed-upon" name; after all, I doubt there's a standards body whose job it is to review these things. That said, maybe you'll find one of these acceptable:
- Answer
- Result
- Value
- Digits
I think "Display" would make sense if you were describing it in real-world terms.
精彩评论