Hi,
I need help with the following Delphi exercise.
1. Create a form and choose numbers randomly. The loop stops when the number 10 is chosen. (Use Randomize once Before the Loop).
Delphi Exercises (While Loop)
Moderator: General Moderators
-
RomeoMabasa
- Forum Newbie
- Posts: 4
- Joined: Sat Mar 17, 2007 4:56 am
-
RomeoMabasa
- Forum Newbie
- Posts: 4
- Joined: Sat Mar 17, 2007 4:56 am
Re:Delphi Exercises (While Loop)
feyd | Please use
-------------------
If I try the If Statement it works:
Here's the code:
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
It's one of the exercises I'm working on.
I have:
[syntax="delphi"]var inum:integer
Begin
inum:=IntToStr(EdtCapture.text);
while inum <> 10 do
RedDisplay.Lines.Add(StrToInt(inum)); // To Display the number that the user has selected
//Don't know how to make sure that the loop doesn't go endlessly.
end;If I try the If Statement it works:
Here's the code:
Code: Select all
If inum <> 10 then
RedDisplay.Lines.Add(StrToInt(inum))
Else
LblMessage.Caption:='The number 10 has been captured';
end; //Iffeyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]