
-----------------------------------
Velocity
Tue Nov 15, 2011 4:46 pm

How do you make the for statement max number be the number of the get statement?
-----------------------------------


var years, sBalance, interest, fBalance : real
var yearS : int
colorback (91)
cls
put "How many years on your term? " ..
get years
put "What is your starting balance? " ..
get sBalance
put "What is your interest?(e.g. 9% = 0.09)" ..
get interest

Time.Delay (3000)
cls

fBalance := sBalance * interest

locate (5, 20)
put "Year"
locate (4, 33)
put "Starting"
locate (5, 33)
put "Balance"
locate (5, 48)
put "Interest"
locate (4, 65)
put "Final"
locate (5, 65)
put "Balance"
for year : 1 .. years
    put year
end for




My question is exactly as the thread reads, i want to make the max number of years in the for statement.

-----------------------------------
DemonWasp
Tue Nov 15, 2011 5:09 pm

RE:How do you make the for statement max number be the number of the get statement?
-----------------------------------
Your problem doesn't have anything to do with the get statement. The problem is that you must use integers (..., -2, -1, 0, 1, 2, 3, ...) as bounds on for statements; you cannot use real numbers (3.14).

Not allowed:

for i : 1 .. 3.2


Totally allowed:

for i : 1 .. 3


If you read the error statement that Turing gives you when you try this, it's fairly obvious (it even highlights years):
'for' range bounds must be both integers, chars, or elements of the same enumerated type

-----------------------------------
Velocity
Tue Nov 15, 2011 5:20 pm

RE:How do you make the for statement max number be the number of the get statement?
-----------------------------------
nononono but you dont understand what im trying to get at, i want for it to display number down the screen under the years column so that for how many ever years you type in it enters that many in the column

-----------------------------------
Aange10
Tue Nov 15, 2011 5:38 pm

RE:How do you make the for statement max number be the number of the get statement?
-----------------------------------
Velocity: This is exactly why you should fill out the pre-formatted post completely, instead of erasing it all.


 How do you make the for statement max number be the number of the get statement?

My question is exactly as the thread reads, i want to make the max number of years in the for statement.


I'm going to take it this is your problem...

Lets break it down - literally:

How do you make the for statement

[code]
for i : min .. max
[/code]

max numbers be the number of the get statement

[code]
get get_statement
for i : 1 .. get_statement
[/code]

Now putting your question back together...

How do you make the for statement max number be the number of the get statement?

[code]
get get_statement
for i : 1 .. get_statement
end for
[/code]

-----------------------------------
evildaddy911
Wed Nov 16, 2011 7:58 am

RE:How do you make the for statement max number be the number of the get statement?
-----------------------------------
try using "months" as an integer instead of "years" as a real
