C语言小程序算法的表示.pdf
第27卷 第3期 天 津 理 工 大 学 学 报 V01.27No.3
2011年 6月 JOURNALOFTL NJIN UNIVERSITYoFTECHNOLOGY Jun.2011
文章编号:1673—095X(2011)03—0033-04
C语言小程序算法的表示
彭旭东,郭宝红,王成霞,李 婧,樊丽珍
(天津理工大学 计算机与通信工程学院,天津 300384)
摘 要 :在 自动评判程序 中的逻辑错误时,一个关键问题是正确表示程序的算法,并解决多样性问题.围绕算法的定
义。提 出用变量的源变量列表 (vsv)和单变量访问流图(SVAF)共同表示程序的算法.其 中VSV用于描述变量间的
计算关系,SVAF用于描述每个变量的操作方式、次序以及相关的程序控制结构.经过规格化操作,可消除VSV和
SVAF中因语句次序、临时变量、特殊赋值语句以及循环语句等引发的多样性问题.
关键词:算法的表示;算法多样性;单变量访问流图;变量源变量列表;算法规格化
中图分类号 :TP311.5 文献标识码 :A doi:10.3969/j.issn.1673-095X.2011.03.OO9
Expressthealgorithm ofasmallprogram inC
PENGXu-dong,GUOBao—hong,WANG Cheng—xia,LIJing,FAN Li—zhen
(SchoolofComputerandCommunicationsEngineering,TianjinUniversityofTechnology,Tianjin300384,China)
Abstract:Inovdertoanalyzeandfindoutlogicerrorsinprogram automatically,itismusttoexpressthealgorithm ofthe
program inunifiedform.Accordingtothedefinitionofalgorithm ,thispapertalksabouthow toexpressthealgorithm with
Variablegsourcevariableslist(VSV)andSinglevariableaccessedflow (SVAF)fromdifferentsides,andhowtonomral—
ize.VSV isusedforexpressingtherelationshipsamongthevariableswhendoingcalculate.AndSVAFisusedofrexpressing
theaccesstype,accessorder,andcontrolflowusedofeveryvariable.Andthemultifomr problems,whichwerecausedby
sentences(andblocks)order,usingtemporary variablesunlimited,specialassignmentstatements,andloopstatements,
wereremovedafternonTlalization.
Keywords:expressthealgorithm ;multifomr ofthealgorithm ;singlevariableaccessedflow;varibalegsourcevariableslist;
uniofmr thealgorithm
准确地表示算法是 自动评判的关键.然而受到
1 C语言小程序
诸多因素的影响,程序中往往存在严重的多样性问
《C语言程序设计》课程中的编程题属于主观 题