Go to Post why would someone do that? Go on the internet and tell lies? - MaGiC_PiKaChU [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-09-2007, 03:21
SwartMumba SwartMumba is offline
Registered User
no team
 
Join Date: Sep 2007
Location: TX <---I'm here
Posts: 2
SwartMumba is an unknown quantity at this point
help with large loop

Can someone please help me to correct my program. I have a variable, LargeNumber. The maximum value that LargeNumber will be is 320000000000, thus I have to declare LargeNumber as Int64. The problem is that the loop does not want to work with my variable, I think because it is declared as Int64. When I try to run the program I get an error message that says, "For Loop control variable must have ordinal type." The following is my Loop:

for Loop := 1 to LargeNumber do
begin

end;

{Since Loop is going to have the same value as LargeNumber, I also declared it as int64}
  #2   Spotlight this post!  
Unread 26-09-2007, 06:54
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: help with large loop

My first questions is, what language are you programming in?
  #3   Spotlight this post!  
Unread 26-09-2007, 07:14
Jack Jones Jack Jones is offline
Retired
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Waterford, MI
Posts: 964
Jack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond repute
Re: help with large loop

Use nested loops, if you have to.
  #4   Spotlight this post!  
Unread 26-09-2007, 08:22
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
Re: help with large loop

If the compiler accepts LargeNumber as a variable but not as a loop counter, then you could consider using an infinite loop with LargeNumber as a variable that you increment on each pass. Exit the loop when LargeNumber is greater than or equal to the # of passes that you want.
__________________

Don't PANIC!
S. P. A. M.
  #5   Spotlight this post!  
Unread 26-09-2007, 09:21
ebarker's Avatar
ebarker ebarker is offline
Registered User
AKA: Ed Barker
FRC #1311 (Kell Robotics)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Kennesaw GA
Posts: 1,437
ebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond repute
Re: help with large loop

A for loop is a higher level construct of a more primitive algorithm.

You can just implement the base algorithm instead.

The base algorithm has an initializer, a test & branch, the inner block, the incrementer and branch.

One assignment, one test, one arithmetic operator.

Enjoy
__________________
Ed Barker
  #6   Spotlight this post!  
Unread 26-09-2007, 20:43
Kelly Kelly is offline
Registered User
FRC #1418
 
Join Date: Jan 2007
Location: VA
Posts: 78
Kelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud of
Re: help with large loop

With a for loop that large, it sounds like you're trying to create some sort of time delay. Assuming you're writing code for the robot controller, remember that your code is already running in a loop. To create a time delay write code like this:

int counter
.
.
.
while(true)//main loop
{
counter++;
if counter<largeNumber
{
do nothing
}
else
{
do stuff
}
}
If this is for a side project, disregard this comment entirely.
  #7   Spotlight this post!  
Unread 26-09-2007, 21:23
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: help with large loop

Quote:
Originally Posted by chris31 View Post
My first questions is, what language are you programming in?
It looks like Pascal, so I'm guessing Delphi.

SwartMumba, this isn't a Delphi programming language forum. Look here for suggestions on better places to look for assistance.
  #8   Spotlight this post!  
Unread 26-09-2007, 23:08
SwartMumba SwartMumba is offline
Registered User
no team
 
Join Date: Sep 2007
Location: TX <---I'm here
Posts: 2
SwartMumba is an unknown quantity at this point
Re: help with large loop

Quote:
Originally Posted by chris31 View Post
My first questions is, what language are you programming in?
Delphi. I thought this was a Delphi forum, www.chiefdelphi.com.


Quote:
Originally Posted by Jack Jones View Post
Use nested loops, if you have to.
The value of LargeLoop varies, making life hard if you want to nest loops. There should be an easier way.

Quote:
Originally Posted by EricS-Team180 View Post
If the compiler accepts LargeNumber as a variable but not as a loop counter, then you could consider using an infinite loop with LargeNumber as a variable that you increment on each pass. Exit the loop when LargeNumber is greater than or equal to the # of passes that you want.
I tried that and the Loop crashes at 10000000000 Loops

Quote:
Originally Posted by Alan Anderson View Post
It looks like Pascal, so I'm guessing Delphi.

SwartMumba, this isn't a Delphi programming language forum. Look here for suggestions on better places to look for assistance.
Oh,okey..
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: Holomonic (Bottom View) with Large Omni-Directional Wheel Kit nonother Extra Discussion 9 16-05-2007 00:26
Help! Making Continuous Loop out of Plastic Sheet evolution Technical Discussion 7 19-02-2006 13:47
problem with using a loop CompMaster Programming 7 03-02-2006 16:44
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 21:46
NEED HELP with Delay loop for compressor relay switch archiver 2001 10 24-06-2002 02:11


All times are GMT -5. The time now is 19:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi