⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iqtest_impl.pas

📁 Delphi 7组件与分布式应用开发源码,介绍了基础的组件应用实例
💻 PAS
字号:
unit IQTest_impl;

{This file was generated on 16 Nov 2002 13:58:26 GMT by version 03.03.03.C1.A2}
{of the Inprise VisiBroker idl2pas CORBA IDL compiler.                        }

{Please do not edit the contents of this file. You should instead edit and    }
{recompile the original IDL which was located in the file Examination.idl.    }

{Delphi Pascal unit      : IQTest_impl                                        }
{derived from IDL module : IQTest                                             }



interface

uses
  SysUtils,
  CORBA,
  IQTest_i,
  IQTest_c;

type
  TIIQTest = class;
  TIQTestFactory = class;

  TIIQTest = class(TInterfacedObject, IQTest_i.IIQTest)
  protected
    {******************************}
    {*** User variables go here ***}
    {******************************}
  public
    CorrectNumber : Integer; //    答对个数
    constructor Create;
    function  Check ( const QuestionNo : Integer;
                      const QuestionAnswer : Integer): Boolean;
    function  Score : Integer;

  end;

  TIQTestFactory = class(TInterfacedObject, IQTest_i.IQTestFactory)
  protected
    {******************************}
    {*** User variables go here ***}
    {******************************}
  public
    constructor Create;
    function  CreateInstance ( const InstanceName : AnsiString): IQTest_i.IIQTest;
  end;


implementation

uses ServerUnit1;

constructor TIIQTest.Create;
begin
  inherited;
      CorrectNumber :=0;     //初始化答对个数变量
end;

function  TIIQTest.Check ( const QuestionNo : Integer;
                           const QuestionAnswer : Integer): Boolean;
begin
  
  case  QuestionNo of
    //第一题
    1:  if QuestionAnswer = 2 then
        begin
          result :=true;                 //答对则返回正确
          CorrectNumber :=CorrectNumber + 1;   //答对题数加一
          Form1.Memo1.Lines.Append( DateToStr(Date) + ' ' + TimeToStr(Time) + '   第一题完成,答案正确!');
        end
        else
        begin
          result :=false;
          Form1.Memo1.Lines.Append( DateToStr(Date) + ' ' +TimeToStr(Time) + '   第一题完成,答案错误!');
        end;
    //第二题
    2:  if QuestionAnswer = 3 then
        begin
          result :=true;                        //答对则返回正确
          CorrectNumber :=CorrectNumber + 1;    //答对题数加一
          Form1.Memo1.Lines.Append( DateToStr(Date) + ' ' + TimeToStr(Time) + '   第二题完成,答案正确!');
        end
        else
        begin
          result :=false;
          Form1.Memo1.Lines.Append( DateToStr(Date) + ' ' +TimeToStr(Time) + '   第二题完成,答案错误!');
        end;
  else
    result :=false;
  end;
end;

function  TIIQTest.Score : Integer;
begin
  result := CorrectNumber;
  Form1.Memo1.Lines.Append( DateToStr(Date) +' ' + TimeToStr(Time) + '   IQ测试已完成,总题数为2题,答对'+ IntToStr(CorrectNumber) + ' 题!');
end;

constructor TIQTestFactory.Create;
begin
  inherited;
  { *************************** }
  { *** User code goes here *** }
  { *************************** }
end;

function  TIQTestFactory.CreateInstance ( const InstanceName : AnsiString): IQTest_i.IIQTest;
begin
  { *************************** }
  { *** User code goes here *** }
  { *************************** }
end;


initialization


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -