Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi Project.-Files, Managing Operators, Records

Status
Not open for further replies.

000lynx

Programmer
Sep 24, 2007
5
AU
Hello, i have to make a Managment program in delphi for manaing differnt operators at a fundraiser event. I will need to-:

Add Operators
--Each operator needs to have a Six character, INCREMENTALL generated ID. SO the first operator will be SA0001, and the second one added will be SA0002 and so on. Just wondering how i would do this? What code?
Also im making records, and i know that to limit the string size i do for example, Name:String[10]; which gives it 10bytes, how do i do that for a Real Number? Real[4]; for example, doesnt work??

ALSO does anyone know how to use the PRINT function in delphi? basically i need to get some data from a file, display it in printing format, and print it.

THANK YOU VERY MUCH for your time.
000lynx
 
--Each operator needs to have a Six character, INCREMENTALL generated ID. Just wondering how i would do this? What code?

Keep the numerical ID in memory, and format it into the IDs you describe. IntToStr() does that, add the appropriate number of zeros to the front, and then add the 'SA' part.

how do i do that for a Real Number? Real[4]; for example, doesnt work??

You don't. All variables are finite sizes. By virtue of the nature of a string, you can specify the length (10 letters or 25 letters?), but beyond that, you can not.

Real is not a standardized data type, anyway. I would suggest "single" instead, since it is standardized and can be used within the floating-point units that are on most all processors these days.

ALSO does anyone know how to use the PRINT function in delphi?

If you mean how to print something on a printer, see the link below:

 
thanks glen! one part i dont get though, how do i actually DO the incrementally generated thing, what will the code look like? im not sure..?

thank you
 
Code:
procedure IncDemoLoop;
var
  i: integer;
  x: single;
  n: integer;
begin
  x:= 10; //start with 10 just for grins
  n:= 1;
  for i:= 0 to 7 do begin
    x:= x + 1; //inc X by one
    inc(n);    //built in function for integer types
    //do something with the output
    showmessage('X is now ' + format(%n, [x]) + ' and N = ' + IntToStr(n)); 
  end;
end;
Un-tested

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top