문제

I am currently teaching myself iPhone programming and working on solving assignment 2 [PDF] of this year Stanford CS193p course.

There's something I don't understand about Required Task 1. One is supposed to add variable support to RPN calculator so that it could be programmed. However, what is the presumed way for someone to use this feature? That is:

  • What sequence of calculator buttons should set a variable?
  • How should the user run a predefined calculator program with predefined values of variables?

Note that there is no "store" or "run" buttons in screenshot at page 5.

도움이 되었습니까?

해결책

In this assignment, you can just run the variable-include program by using Test Buttons(Task 3). Maybe the follow assignment will require implementing the "set" and "run" function.

다른 팁

I'm not sure that the sequence of variable definition is overly important. Entered variables display in a separate section, so it should work as long as they're there before the "Enter" key is pressed. In fact, you'll probably want to show a warning if they're not.

In fact what you do is create an equation in your stack. For that you add variables buttons to define your equation. Something like: f(x,y,x) = x^2 + Y^2 + z^2 Later you evaluate the equation given a set of values for x,y,z.

Very useful to create a Graphing Calculator!

The way this program is intended to work, I believe, is that you type in variables and by using the Test buttons those variables should get substituted for values - according to the array you input then run.

Should you enter variables during normal calculation, they should be set to zero before evaluating the result.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top