更新: 该程序的版本位于
应别人的要求号后四位计算器,用Pascal编写的一个小程序号后四位计算器,现在是开源的.
该程序根据开放源代码协议WTFPL发布.
program sfz; { DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. } const a:array[1..18] of integer=(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1); ass:array[0..10] of char=('1','','x','9','8','7','6','5','4','3','2'); var i,t,j,as:integer; c:char; cc:array[1..17] of char; begin writeln('号解算 v0.0'); writeln; writeln('请输入号(前17位):'); writeln; as:=0; for i:=1 to 17 do begin read(c);cc[i]:=c; t:=ord(c)-48; inc(as,a[i]*t); end; //writeln; as:=as mod 11; //writeln(as mod 11); writeln; writeln('完整有效的号是:'); writeln; for i:=1 to 17 do write(cc[i]); writeln(ass[as]); writeln;writeln;writeln;writeln( 'This program is written by @chenxiaoqino, thanks for using.'); readln;readln; end.
GeSHi突出显示的代码.
0.016 / 0.054 / 0.001秒(语言加载/解析/清理)
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-149641-1.html
愚者图虚名