Professional Documents
Culture Documents
Chapter7 Exercise 3
Chapter7 Exercise 3
Declaration
InputFile win_Cus
InputFile sum_Cus
Outputfile mergefile
num win_Cus_Id
num id=0
string win_First_Name
string win_Last_Name
string win_Class
num win_Age
num sum_Cus_Id
string sum_First_Name
string sum_Last_Name
string sum_class
num sum_Age
num end_Num=9999
String areBothAtEnd=”N”
getReady()
While areBothAtEnd=”Y”
mergeRecord()
endwhile
finish()
stop
getReady()
readWin()
readSum()
return
readWin()
Win_Age, win_Class
if eof then
win_Cus_Id=end_Num
Endif
Return
readSum()
if eof then
sum_Cus_ID=end_Num
endif
return
checkEnd()
areBothAtEnd=”y”
endif
endif
return
mergeRecord()
if win_Cus_Id<sum_Cus_Id then
output win_Cus_Id,win_First_Name,
win_Cus_Last_Name
to mergefile
readWin()
else
output sum_Cus_Id,sum_First_Name,
sum_Last_Name to
merge file
readSum()
endif
checkEnd()
return
finish()
close win_Cus
close sum_Cus
close mergefile
return