RSS Forums RSS
Please support our Pascal and Delphi advertiser: Programming Forums

!!! Help ME !!!!!

Join Date: Dec 2006
Location: Romania
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: !!! Help ME !!!!!

  #10  
Mar 28th, 2007
Originally Posted by chickenmcnugget View Post
in way i do and it sounds like your bashing me and i said i needed help starting it thats what i said man and open up the other one thats there too above the one you opened so you know i know what im doing and btw man im not a top flight programmer thats why im here


you don't need to be an top programmer, you must want to learn, and try to understand. this is a very simple task which could be done if you took a delphi book, and try to accomplish it

code:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
function prime(number:integer):string;
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=prime(strtoint(edit1.Text));
end;

function TForm1.prime(number:integer): string;
var i:integer;
prime:boolean;
begin
Label1.Caption:='';
prime:=true;
result:='prime';
if (number=1) or (number=2) or (number=3) then prime:=true
else
for i:=2 to round(sqrt(number)) do
if number mod i=0 then
begin
prime:=false;
result:='not prime';
exit;
end;
end;

end.

hope you'll try to understand this program, not only to copy it and past it.

best regards,
Last edited by radu84 : Mar 28th, 2007 at 4:00 pm.
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:14 am.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC