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

Username:   Password: 
 RegisterRegister   
 Just made my account here and Its my first question.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
naqibaba




PostPosted: Thu Dec 03, 2009 3:50 am   Post subject: Just made my account here and Its my first question.

The outpout should look like this :

"The decimal equilent of 1/2 is 0.500
The decimal equilent of 1/3 is 0.300
..
..
The Decimal equilent of 1/10 is 0.100"


I am having difficulty in calling the variables. Its showing an error here.

"var first:=0.5
var last:=0.1
for count: first..last"

"The error is "for range bound must be both integers, chars or elements of the same enumerated type."
What does that mean?


Once I am able to call these variables, Prog will be done. Its showing an error on both real and integer. I would greatly appreciate any help.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Dec 03, 2009 4:11 am   Post subject: RE:Just made my account here and Its my first question.

it appears that you are trying to have a forloop count from 0.5 to 0.1
code:

for count: 0.5 .. 0.1
 ...
end for

What kind of values would you expect "count" to have, as the loop executes?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
naqibaba




PostPosted: Thu Dec 03, 2009 9:04 am   Post subject: Re: RE:Just made my account here and Its my first question.

Tony @ Thu Dec 03, 2009 4:11 am wrote:
it appears that you are trying to have a forloop count from 0.5 to 0.1
code:

for count: 0.5 .. 0.1
 ...
end for

What kind of values would you expect "count" to have, as the loop executes?





This is not working. I have also tried "for decreasing count:0.5..0.1" but still the error is the same. This is killing me.
Draymire




PostPosted: Thu Dec 03, 2009 9:11 am   Post subject: Re: Just made my account here and Its my first question.

try something like this

code:

for decreasing i: 5 .. 1
count=i/10
...
end for


this should work, and it gives you your 0.5-0.1 like you want Smile
TheGuardian001




PostPosted: Thu Dec 03, 2009 9:12 am   Post subject: Re: Just made my account here and Its my first question.

naqibaba wrote:

This is not working. I have also tried "for decreasing count:0.5..0.1" but still the error is the same. This is killing me.


What Tony means is, what values are in between 0.5 and 0.1? If you were to go through every value, what values would you get?

And back to the error message
Quote:

"The error is "for range bound must be both integers, chars or elements of the same enumerated type."


Do you know what an integer is? Are either of the bounds on your for loop integers?
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: