分析:根据题意分析得出:本题主要考查考生的字符串指针或字符串数组以及根据公式进字符的ASCII值运算,再根据运算结果和条件进行相应的替代操作,要求考生仅编写函数encryptChar()实现转换功能。其中输入及输出函数给出且已调用,考生不必自己编写。 编写函数encryptChar()的程序内容如下:
$ S( S, O) b5 j6 b9 G void encryptChar()/ ^' S5 ? `, B$ p/ W6 ?5 Q9 E8 B
{ int i, j, val ;8 a% O; o- |) ~( K5 Q' g
for(i=0 ; i
4 m) [* N- u9 }0 E for(j=0 ; j
3 H7 m' d7 L4 N, m1 {( y+ w val=(xx[j]*11) % 256 ;
9 c+ k- F# U% {/ d/ e* g Y; N2 d if(! (val130)) xx[j]=val ;+ B+ ^- r( ~4 k8 L$ F0 J4 B
}0 y5 N5 C( m- J5 p2 o! m- c' U
}% w9 M* V0 e9 |6 y5 L
数据文件IN.DAT内容如下:
$ \: y+ U! e- J+ }( Y) u8 U8 k; N: n You may WANT A FIELD in field in each record to uniquely identify that1234
; u4 q" b" s& a1 D5 }. \ record from all other records IN THE FILE. For example, the Employee123456" Y: [2 q% j# X: I' s5 @$ E$ u- e
Number field is unique if you DO NOT ASSIGN the same number to two12345678/ r3 u. y; T- ?% \" [- y! e1 B/ l8 Q
different employees, and you never reassign THESE NUMBERS to other12345678) }2 k% ?) L% l( [# g0 c1 ?% Z& C
employees. If you wish to FIND OR MODIFY the record belonging to a11111111' ~5 j1 K! _ D: }
specific employee, this unique FIELD SAVES the thouble of determining22222( F1 j. [. s0 z% y
whether you have the correct record.12345678901234567
- ?' d! T3 N' z# h( N If you do not have a unique field, YOU MUST FIND THE first record123456787
5 u# j' L9 I1 f, |* I2 K the matches your key and determine whether THEN RECORD is the one you33333& b, {( v" X) L& d/ Z8 O3 k2 i0 b6 ]
want. If it is not the CORRECT ONE, you must search again to find others.4 |