Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How do you make the for statement max number be the number of the get statement?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Velocity




PostPosted: Tue Nov 15, 2011 4:46 pm   Post subject: How do you make the for statement max number be the number of the get statement?

Turing:


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.
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Tue Nov 15, 2011 5:09 pm   Post subject: 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:
Turing:

for i : 1 .. 3.2


Totally allowed:
Turing:

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):
Turing wrote:
'for' range bounds must be both integers, chars, or elements of the same enumerated type
Velocity




PostPosted: Tue Nov 15, 2011 5:20 pm   Post subject: 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




PostPosted: Tue Nov 15, 2011 5:38 pm   Post subject: 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.

Velocity wrote:

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


max numbers be the number of the get statement

code:

get get_statement
for i : 1 .. get_statement


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
evildaddy911




PostPosted: Wed Nov 16, 2011 7:58 am   Post subject: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: