(zhn)现在的位置Q?/strong> 跨考网频道考研报名正文

四川大学C语言2004q真题_跨考网

最后更新时_(d)(x)2011-08-26 06:20:10
辅导评Q?a target="_blank" rel="nofollow">暑期集训 在线咨询
复习(fn)紧张Q焦头烂额?逆风轻袭Q来跨考秋季集训营Q帮你寻Ҏ(gu)Q定Ҏ(gu)Q?/span> ?jin)解一?>

a的|?span lang="EN-US">a,b 均ؓ(f) int ,每个表达式运到a=2,b=3?span lang="EN-US">(5?span lang="EN-US">)

(1) a+=b*5

//a=a+b*5,?span lang="EN-US">17

(2) a=b++

//a=3

(3) a%=(a%=b)

//l果?span lang="EN-US">0

(4) a=a>b&&b>a||a

//>的优先高(sh)&&?span lang="EN-US">||原式理解?span lang="EN-US">(a>b)&&(b>a)||a

&&q算W高?sh)?span lang="EN-US">||,原式理解?span lang="EN-US">((a>b)&&(b>a))||a,因ؓ(f)agؓ(f)2Q结果ؓ(f)1真。或q算是有一?span lang="EN-US">1

(5) a=!b<A&&!A<B< p>

//!的运符最高,<其次Q?span lang="EN-US">&&最原式理解ؓ(f)((!b)<A)&&((!A)<B))l果?span lang="EN-US">1< p>

(10?span lang="EN-US">)

include ?span lang="EN-US">stdio.h?span lang="EN-US">

struct node /*有向囄节点cd*/

{ int key;

struct node *left,*right,*up,*down;

;

int main (int argc ,char * argv [])

{ int i;

struct node nodes[5];

for( i=0;i<5;i++)

{ nodes [i].key=i;

nodes [i].left=NULL;

nodes [i].right=NULL;

nodes [i].up=NULL;

nodes [i].down=NULL;

nodes [0].left=nodes+1;

nodes [1].left=nodes;

nodes [1].up=nodes+2;

nodes [2].down=nodes+3;

nodes [3].right=nodes+4;

nodes [4].up=nodes;

nodes [4].down=nodes+1;

return 0;

0

4

2

2

3

(10?span lang="EN-US">)

int sameChar sAT SamePos (char *s1,char *s2);

(串结束符‘\0?/span>不比?span lang="EN-US">)?span lang="EN-US">

s1="abc",s2="Abc",则返回gؓ(f)2?span lang="EN-US">

int sameCharAtSame Pos (char *s1,char *s2)

{

int counter =0;

while (*sl && *s2)

{

if (*s1 == *s2)

counter ++;

s1++;

s2++;

return counter;

(15?span lang="EN-US">)

AQ?span lang="EN-US">CQ?span lang="EN-US">GQ?span lang="EN-US">U四个字符l成Q如下所C:(x)

ACUGCCCAUGAAAAACUUUUGACAC

“AUG?/span>后开始,遇到“UGA?/span>l束(不包?span lang="EN-US">“AUG?/span>?span lang="EN-US">“UGA?/span>?span lang="EN-US">)如上面的~码串需解码的有效子串ؓ(f)Q?span lang="EN-US">

AAAAACUUU

3个字W?span lang="EN-US">(?span lang="EN-US">“AAA?/span>Q?span lang="EN-US">“CGA?作ؓ(f)一个密码子(可以保证Q有效子串的长度一定ؓ(f)3的整数倍?span lang="EN-US">)可能的密码子(62U?span lang="EN-US">)?qing)相应码g如下形式攑֜~码文gcode.txt?span lang="EN-US">(按密码子字典序排?span lang="EN-US">);

AAA K

AAC N

………?p>

UUU F

CE序对存攑֜文g中的Ҏ(gu)字符串解码,在屏q输?gu)码串。如Q?span lang="EN-US">KNF

KNE

1、编码文?span lang="EN-US">code.txt攑֜c盘根目录?span lang="EN-US">;

2、要解码的特D字W串以文件Ş式存放,其串长不过1024字符;

3、你~写的程序应能处理命令参敎ͼ指定要解码的字符串文?span lang="EN-US">;

4、程序中可以使用C语言的标准库函数Q不需要写出头文g;

5、程序中应有必有的注释?span lang="EN-US">

#include ?span lang="EN-US">stdio.h?span lang="EN-US">

#include ?span lang="EN-US">string.h?span lang="EN-US">

struct

{

char name[4];

char code;

table [62];

int main (int argc,char *argv [ ])

{

FILE *codeB file=NULL, *string file =NULL;

char string [1024+2],buffer[4],*p,*end ;

int I;

/* (g)查命令行参数*/

if (argc<=1)

/*打开~码文g以及(qing)待解码文?span lang="EN-US">*/

codeB file=fopen ("c:\\code. txt","r");

string file =fopen (argv[1],"r");

if (code_file= = NULL | | string_file = =NULL)

return 1;

/* ȝ码文Ӟ结果记入表?span lang="EN-US"> */

for (i=0; i<62; i++)

{

fscanf(code_file, "%s %c\n", tabie[i], name, &table[i].code);

}

/*d解码文g内容?span lang="EN-US">string?span lang="EN-US"> */

fgets (string, sizeof (string), string_file);

/* 扫描有效子串?span lang="EN-US"> */

p= strstr(string, "AUG");

end = strstr (p + 3 , "UGA");

/*L效子Ԍ查表输出解码字符Q直到子串尾 */

for (p+=3; p

{

for (i=0; i<3; i++)

{

buffer [i] = p [i];

}

buffer [i] ='\0';

for (i=0; i<62; i++)

{

if (strcmp (buffer, table [i].name)) = = 0)

{

printf("%c", table[i]. code);

break;

}

}

}

/* 关闭~码文g以及(qing)待解码文?span lang="EN-US"> */

fclose (code_file);

fclose (string_file);

return 0;

}

 (tng)

跨考考研评

班型 定向班型 开班时?/td> 高定?/td> 标准?/td> 评介绍 咨询
U季集训 冲刺?/td> 9.10-12.20 168000 24800?/td> 班面授+专业??+专业译֮向辅?协议加强评(高定?+专属规划{疑(高定?+_化答?复试资源(高定?+复试译֌(高定?+复试指导(高定?+复试班主?v1服务(高定?+复试面授密训(高定?+复试1v1(高定?
2023集训畅学 非定向(政英?数政qQ?/td> 每月20?/td> 22800?协议? 13800?/td> 先行阶在U课E?基础阶在U课E?强化阶在U课E?真题阶在U课E?冲刺阶在U课E?专业NҎ(gu)一对一评+班主dE督学服?全程规划体系+全程试体系+全程_化答?择校择专业能力定位体p?全年关键环节指导体系+初试加强?初试专属服务+复试全科标准班服?/td>

①凡本网注明“稿件来源:(x)跨考网”的所有文字、图片和韌频稿Ӟ版权均属北京学博教育咨询有限公司Q含本网和跨考网Q所有,M媒体、网站或个h未经本网协议授权不得转蝲、链接、{帖或以其他Q何方式复制、发表。已l本|协议授权的媒体、网站,在下载用时必须注明“稿件来源,跨考网”,q者本|将依法q究法律责Q?/p>

②本|未注明“稿件来源:(x)跨考网”的?囄Eg均ؓ(f)转蝲E,本网转蝲仅基于传递更多信息之目的Qƈ不意味着再通{载稿的观Ҏ(gu)证实其内容的真实性。如其他媒体、网站或个h从本|下载用,必须保留本网注明的“稿件来源”,q自负版权等法律责Q。如擅自改为“稿件来源:(x)跨考网”,本网依法追I法律责仅R?/p>

③如本网转蝲E涉?qing)版权等问题Q请作者见E后在两周内速来?sh)与跨考网联系Q电(sh)话:(x)400-883-2220