Hi everyone!
I think I'll be on here allot from now on, pretty useful forum, well done!
Anyways, I'm doing a project for school and it's got me stuck.
See I didn't understand the error message the compiler gave me at first, but then I read it on ...some website, it says that the Float/Real variable types are not a valid ordinal type?
Basically what I need to do is create a program that would ask for six grade points, and then give a average and the symbol they reached.
Here is the error messages I received;
[Error] gradering.pas(49): Ordinal type required
[Error] gradering.pas(63): '.' expected but ';' found
[Fatal Error] gradering_p.dpr(5): Could not compile used unit 'gradering.pas'
I'm first focusing on the first error, then moving on to the second one, help with that would be appreciated as well.
Here is what I have so far, sorry for the language, I'm doing IT in an Afrikaans school.
unit gradering;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TfrmGradering = class(TForm)
pnlAgtergrond: TPanel;
lblPunt: TLabel;
lblAf_punt: TLabel;
lblPunt2: TLabel;
edtPunt: TEdit;
lblAfvoer: TLabel;
bmbRetry: TBitBtn;
bmbClose: TBitBtn;
btnTel: TButton;
procedure btnTelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmGradering: TfrmGradering;
iTeller : integer;
rTotaal, rGemiddeld : real;
sSimbool, sAfvoer : string;
implementation
{$R *.dfm}
procedure TfrmGradering.btnTelClick(Sender: TObject);
begin
if iTeller < 6 then
begin
Inc(iTeller, 1);
rTotaal := rTotaal + StrToInt(edtPunt.Text);
lblAf_punt.Caption := IntToStr(iTeller);
end
else if iTeller = 6 then
begin
rGemiddeld := ((rTotaal / 6) * 100);
case rGemiddeld of
80..100 : sSimbool := 'A';
70..79 : sSimbool := 'B';
60..69 : sSimbool := 'C';
50..59 : sSimbool := 'D';
40..49 : sSimbool := 'E';
30..39 : sSimbool := 'F';
20..29 : sSimbool := 'G';
else sSimbool := 'H';
end
end
end;
end;
end.
Thanks in advance guys!