Can anyone explain how to store a string as a variable?

  • #1
breebreebran
12
0
I don't have any big programs. I just write programs to get me through my math classes.
But I want to have the output look pretty.
Like one program I have is for my finance class.

Code:
prompt p
if p = 1
then
Prompt b,r,n,t
r/100→x
b/(1+x/n)^(n*t)→l
disp l
else
Prompt b,r,n,t  
r/100 → x  
b*(x/n)/((1+x/n)^(n*t)-1) → m  
disp m

But what I want to do is instead of prompting p, I want to prompt "present value?"
Then If present value = 1 then etc.
It just looks neater if it prompts an entire string instead of one letter.
So instead of prompting b,r,n,t it'll prompt
"Ending Balance?"
"Rate?"
"Number of compounds?"
"Time?"
And then I can save those strings as variables.
So ending balance → b
Rate → r
Number of compounds → n
And then just have the rest of the program work with those letters instead of having to type out (rate/numberofcompounds)
Every time I try to use strings instead of letters it always gives me a syntax error.
Any help?
 

Answers and Replies

  • #3
36,464
8,432
breebreebran, you didn't say what kind of calculator you have, which would be useful information. It's possible that the prompt command has an optional first parameter of a string, like this:
prompt "Present value? ", p

If not, do as jedishrfu suggests, and print the string before executing the prompt.
 

Suggested for: Can anyone explain how to store a string as a variable?

  • Last Post
Replies
6
Views
506
Replies
14
Views
135
Replies
5
Views
306
Replies
11
Views
600
Replies
13
Views
2K
  • Last Post
Replies
2
Views
370
  • Last Post
Replies
10
Views
1K
  • Last Post
2
Replies
46
Views
1K
Replies
26
Views
877
Top