找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 289|回复: 3

为什么不能正确得到余数

[复制链接]
发表于 2009-11-23 11:51:03 | 显示全部楼层 |阅读模式 IP:江苏扬州
初学请大家帮助,下面的代码只有B0可以正常取得余数,其它的都不能得到余数,不知为什么?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
st1,st2,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15:string;
b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15:Integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text:='7522663824377223';
st1:=edit1.Text;
a0:=copy(st1,15,1);
b0:=strtoint(a0)*strtoint(a0)+14 mod 10;
a1:=copy(st1,10,1);
b1:=strtoint(a1)*strtoint(a1)+7 mod 10;
a2:=copy(st1,1,1);
b2:=strtoint(a2)*strtoint(a2)+9 mod 10 ;
a3:=copy(st1,11,1);
b3:=strtoint(a3)*strtoint(a3)+16 mod 10 ;
a4:=copy(st1,9,1);
b4:=strtoint(a4)*strtoint(a4)+15 mod 10 ;
a5:=copy(st1,3,1);
b5:=strtoint(a5)*strtoint(a5)+10 mod 10 ;
a6:=copy(st1,2,1);
b6:=strtoint(a6)*strtoint(a6)+3 mod 10 ;
a7:=copy(st1,14,1);
b7:=strtoint(a7)*strtoint(a7)+13 mod 10 ;
a8:=copy(st1,8,1);
b8:=strtoint(a8)*strtoint(a8)+2 mod 10 ;
a9:=copy(st1,4,1);
b9:=strtoint(a9)*strtoint(a9)+1 mod 10 ;
a10:=copy(st1,12,1);
b10:=strtoint(a10)*strtoint(a10)+12 mod 10 ;
a11:=copy(st1,7,1);
b11:=strtoint(a11)*strtoint(a11)+8 mod 10 ;
a12:=copy(st1,6,1);
b12:=strtoint(a12)*strtoint(a12)+4 mod 10 ;
a13:=copy(st1,13,1);
b13:=strtoint(a13)*strtoint(a13)+5 mod 10 ;
a14:=copy(st1,16,1);
b14:=strtoint(a14)*strtoint(a14)+6 mod 10 ;
a15:=copy(st1,5,1);
b15:=strtoint(a15)*strtoint(a15)+11 mod 10 ;
edit2.Text:=inttostr(b0)+inttostr(b1);
end;
end.
发表于 2009-11-23 11:51:06 | 显示全部楼层 IP:江苏扬州
已解决,原来要将前面用数值用()括起来,如:

b10:=(strtoint(a10)*strtoint(a10)+12) mod 10 ;
回复

使用道具 举报

发表于 2009-11-23 11:51:09 | 显示全部楼层 IP:江苏扬州
不能粗心啊,

不是技术的问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 13:20 , Processed in 0.214777 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表