Does anyone see anything obviously out of whack with the placement or declaration of the procedures? and can anyone suggest why the Case faults on ItemIndex 2?

Thanks, Dik

--------------------------------- Begin Code -------------------------------------------

unit Main_Screen;

interface

uses

Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,

System.Classes, Vcl.Graphics,

Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type

TMain_ScreenF = class(TForm)

Question: TLabel;

Answer: TEdit;

Continue: TButton;

About: TButton;

Main_Screen: TLabel;

procedure FormCreate(Sender: TObject);

procedure AboutClick(Sender: TObject);

procedure FormActivate(Sender: TObject);

*procedure AddRand(add1:integer; add2:integer ;sum:integer);*

procedure SubRand (minu:integer; subt:integer; diff:integer);

procedure MulRand (mulp:integer; mull:integer; prod:integer);

procedure DivRand (divd:integer; divs:integer; quo:integer);

procedure EqualRand (num1:integer; num2:integer; eqal:integer; logi:integer);

I get compile errors no matter where I place these

procedure SubRand (minu:integer; subt:integer; diff:integer);

procedure MulRand (mulp:integer; mull:integer; prod:integer);

procedure DivRand (divd:integer; divs:integer; quo:integer);

procedure EqualRand (num1:integer; num2:integer; eqal:integer; logi:integer);

I get compile errors no matter where I place these

private

{ Private declarations }

public

{ Public declarations }

end;

var

Main_ScreenF: TMain_ScreenF;

**maxadd, maxsub, maxmul, maxdiv, maxans: integer;**

dummy: string;

config: TextFile;

These are global variables

dummy: string;

config: TextFile;

These are global variables

implementation

{$R *.DFM}

uses

Practice, About, Configuration;

var

**add1, add2, sum, minu, subt, diff, mulp, mull, prod, divd, divs, quo, num1, num2, eqal, logi: integer;**

These are variables local to the form

These are variables local to the form

procedure TMain_ScreenF.FormCreate(Sender: TObject);

begin

Left:=(Screen.Width-Width) div 2; // center form

Top:=(Screen.Height-Height) div 2;

end;

procedure TMain_ScreenF.AboutClick(Sender: TObject);

begin

AboutF.ShowModal;

end;

procedure TMain_ScreenF.FormActivate(Sender: TObject);

var

equal: string;

begin

case PracticeF.RadioGroup1.ItemIndex of

1:

Begin

Main_ScreenF.Main_Screen.Caption := 'Addition Practice';

**AddRand(add1; add2; sum); The compiler faults all the procedures: [dcc32 Error] Main_Screen.pas(74): E2035 Not enough actual parameters**

[dcc32 Error] Main_Screen.pas(74): E2014 Statement expected, but expression of type 'Integer' found

[dcc32 Error] Main_Screen.pas(74): E2014 Statement expected, but expression of type 'Integer' found

Question.Caption := IntToStr(add1) + ' + ' + IntToStr(Add2) + ' =';

End;

**2: The compiler faults this stating '[dcc32 Error] Main_Screen.pas(77): E2003 Undeclared identifier: '2', but lets the other 1 - 8 values stand'**

Begin

Main_Screen.Caption := 'Subtraction Practice';

SubRand (minu; subt; diff);

Question.Caption := IntToStr(minu) + ' - ' + IntToStr(subt) + ' =';

End;

3:

Begin

Main_Screen.Caption := 'Greater Than - Less Than Practice';

EqualRand (num1; num2; eqal; logi);

if eqal = 1 then

equal := ' < '

else if eqal = 2 then

equal := ' = '

else if eqal = 3 then

equal := ' > ';

Question.Caption := IntToStr(num1) + equal + IntToStr(Add2);

End;

4:

Begin

Main_Screen.Caption := 'Addition and Subtraction Practice';

AddRand(add1; add2; sum);

SubRand (minu; subt; diff);

Question.Caption := IntToStr(add1) + ' + ' + IntToStr(Add2) + ' =';

Question.Caption := IntToStr(minu) + ' - ' + IntToStr(subt) + ' =';

End;

5:Begin

Main_Screen.Caption := 'Multiplication Practice'

MulRand (mulp; mull; prod);

Question.Caption := IntToStr(mulp) + ' X ' + IntToStr(mull) + ' =';

6:Begin

Main_Screen.Caption := 'Division Practice'

DivRand (divd; divs; quo);

Question.Caption := IntToStr(divd) + ' / ' + IntToStr(divs) + ' =';

7:Begin

Main_Screen.Caption := 'Multiplication and Division Practice'

MulRand (mulp; mull; prod);

Question.Caption := IntToStr(mulp) + ' X ' + IntToStr(mull) + ' =';

DivRand (divd; divs; quo);

Question.Caption := IntToStr(divd) + ' / ' + IntToStr(divs) + ' =';

End;

8:Begin

Main_Screen.Caption := 'Completely Mixed Combinations Practice'

AddRand(add1; add2; sum);

Question.Caption := IntToStr(add1) + ' + ' + IntToStr(Add2) + ' =';

SubRand (minu; subt; diff);

Question.Caption := IntToStr(minu) + ' - ' + IntToStr(subt) + ' =';

MulRand (mulp; mull; prod);

Question.Caption := IntToStr(mulp) + ' X ' + IntToStr(mull) + ' =';

DivRand (divd; divs; quo);

Question.Caption := IntToStr(divd) + ' / ' + IntToStr(divs) + ' =';

EqualRand (num1; num2; eqal; logi);

if eqal := 1 then

equal := ' < ';

else if eqal := 2 then

equal := ' = ';

else if eqal := 3 then

equal := ' > ';

Question.Caption := IntToStr(num1) + equal + IntToStr(Add2);

End;

End;

**//** procedure AddRand **********************************************************

//

// Procedure determines two addends and provides the sum. The addends are

// individually less than the value maxadd and the sum is less than the

// value maxans%. These values are passed to the procedure by a COMMON

// SHARED statement.

//

// PARAMETERS: add1 = first addend

// add2 = second addend

// sum = sum of addends

//

procedure AddRand(add1:integer; add2:integer; sum:integer);

begin

randomize;

add1 := Random(maxadd + 1);

WHILE (sum > maxans) do

begin

add2 := Random(maxadd + 1);

sum := add1 + add2;

end;

end; This is a typical procedure...

//

// Procedure determines two addends and provides the sum. The addends are

// individually less than the value maxadd and the sum is less than the

// value maxans%. These values are passed to the procedure by a COMMON

// SHARED statement.

//

// PARAMETERS: add1 = first addend

// add2 = second addend

// sum = sum of addends

//

procedure AddRand(add1:integer; add2:integer; sum:integer);

begin

randomize;

add1 := Random(maxadd + 1);

WHILE (sum > maxans) do

begin

add2 := Random(maxadd + 1);

sum := add1 + add2;

end;

end; This is a typical procedure...

//** procedure SubRand ********************************************************

//

// Procedure determines two numbers and provides the diference. The numbers

// are individually less than the value maxsub% and the difference is less

// than the value maxans%. These values are passed to the procedure by a

// COMMON SHARED statement.

//

// PARAMETERS: minu = minuend

// subt = subtrahend

// diff = minuend - subtrahend

//

procedure SubRand (minu:integer; subt:integer; diff:integer);

begin

randomize;

While subt > minu do

begin

minu := Random(maxsub + 1);

subt := Random(maxsub + 1);

diff := minu - subt;

end;

end;

//** procedure MulRand *******************************************************

//

// Procedure determines two numbers and provides the product. The numbers

// are individually less than the value maxmul% and the product is less than

// the value maxans%. These values are passed to the procedure by a COMMON

// SHARED statement.

//

// PARAMETERS: mulp = multiplier

// mull = multiplicand

// prod = product

//

procedure MulRand (mulp:integer; mull:integer; prod:integer);

Begin

randomize;

mull := Random(maxmul + 1);

While prod > maxans do

begin

mulp := Random(maxmul + 1);

prod := mull * mulp;

end;

end;

//** procedure DivRand *******************************************************

//

// Procedure determines a dividend and a divisor and provides the quotient.

// The numbers are individually less than the value maxdiv% and the quotient

// is not bounded, but with a normal value of maxdiv%, it is likely less

// than the value maxans%. These values are passed to the procedure by a

// COMMON SHARED statement.

//

// PARAMETERS:

// divd = dividend

// divs = divisor

// quo = quotient

//

procedure DivRand (divd:integer; divs:integer; quo:integer);

Begin

randomize;

quo := Random(maxdiv + 1);

While ((quo > maxdiv) OR (divs = 0)) do

begin

divs := Random(maxdiv + 1);

divd := quo * divs; // divd, divs, and quo are integers

end;

End;

//** procedure EqualRand ******************************************************

//

// Procedure randomly generates two numbers and determines the logical

// comparison between them using a random generated comparison. It returns

// two numbers, the equality sysbol, and and a logical true or false for the

// values generated. The maximum values are passed to the procedure by being

// in scope.

//

// PARAMETERS: num1 = first number

// num2 = Second number

// eqal = Random equality sysbol

// 1 denotes <

// 2 denotes =

// 3 denotes >

// logi = 1 denoted True

// 0 denotes False

//

procedure EqualRand (num1:integer; num2:integer; eqal:integer; logi:integer);

Begin

randomize;

num1 := Random(maxadd + 1);

num2 := Random(maxadd + 1);

eqal := Random(4);

if (num1 - num2) < 0 then

begin

logi := 1;

end

else if (num1 - num2) = 0 then

begin

logi := 2;

end

else if (num1 - num2) > 0 then

begin

logi := 3;

end;

end;

end.