Beginner Delphi, to the officer for help.

Category: Delphi -> Language/Algorithm/System Design Author: fonina11 Date: 2009-11-22 12:34:57
 
fonina11
2009-11-22 12:34:57
Beginner Dlephi, you put two small problems, we hope to help to help, give a complete code.
1: From the natural numbers starting at 1, not divisible by 7 calculated number of positive integers, and these are integer sum required sum can not exceed 32767.
2: Create a Database DeskTop a Paradox-based data table TEST (requires a TESTCOL, type A, size 50), and the database events.db DBDEMOS table appended to the table TEST.
MOSHAHA
2009-11-22 12:51:01
first
procedure TForm1.Button2Click(Sender: TObject);
var
  i,sum,num:integer;
begin
  i:=0;
  num:=0;
  sum:=0;
  while(sum<=32767) do
  begin
    inc(i);// i++
    if(i mod 7)<>0 then
    begin
      sum:=sum+i;
      inc(num);// num++
    end;
  end;
  sum:=sum-i;
  dec(num);// num--
  showmessage(format(' :%d; :%d',[num,sum]));
end;