C语言设计经典英文练习题Word文件下载.docx

上传人:b****2 文档编号:4709835 上传时间:2023-05-03 格式:DOCX 页数:19 大小:17.87KB
下载 相关 举报
C语言设计经典英文练习题Word文件下载.docx_第1页
第1页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第2页
第2页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第3页
第3页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第4页
第4页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第5页
第5页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第6页
第6页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第7页
第7页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第8页
第8页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第9页
第9页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第10页
第10页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第11页
第11页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第12页
第12页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第13页
第13页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第14页
第14页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第15页
第15页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第16页
第16页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第17页
第17页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第18页
第18页 / 共19页
C语言设计经典英文练习题Word文件下载.docx_第19页
第19页 / 共19页
亲,该文档总共19页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

C语言设计经典英文练习题Word文件下载.docx

《C语言设计经典英文练习题Word文件下载.docx》由会员分享,可在线阅读,更多相关《C语言设计经典英文练习题Word文件下载.docx(19页珍藏版)》请在冰点文库上搜索。

C语言设计经典英文练习题Word文件下载.docx

0, 

jc=1;

for 

(i 

1;

<

20;

++i){

jc 

*= 

+= 

jc;

printf 

("

%d\n"

 

sum);

return 

0;

InputxandprintyY=2X,X<

Y=4X-2,0<

=X<

10;

6X(X+3),X>

=10

#include<

intmain()

floatx,y;

printf("

PleaseinputX:

"

scanf("

%f"

&

x);

if(x<

0)

y=2*x;

elseif(x<

10)

y=4*x-2;

else

y=6*x*(x+3);

Y=%f\n"

y);

Inputastringfromkeyboard,writeaprogramtocalculatethenumberofalpha,digitspaceandothercharacter.

charstr[100];

inti=0;

intnum=0,ch=0,blank=0,other=0;

gets(str);

while(str[i]!

='

\0'

if((str[i]>

A'

&

&

str[i]<

Z'

)||(str[i]>

a'

z'

))

ch++;

elseif(str[i]>

0'

9'

num++;

elseif(str[i]=='

'

blank++;

else

other++;

i++;

数字%d个,字母%d个,空格%d个,其他%d个\n"

num,ch,blank,other);

return0;

Read5integerfromkeyboardtosortindescendingorder

inta[5]={0};

inti,j,t;

请依次输入5个整数\n"

for(i=0;

i<

5;

i++)//输入5个数

scanf("

%d"

a[i]);

i++)//从大到小排序

for(j=i+1;

j<

j++)

if(a[i]<

a[j])

t=a[i];

a[i]=a[j];

a[j]=t;

i++)//输出5个数

%d"

a[i]);

CreateFibonaccinumbers,F1=1,F2=1,Fn=Fn-1+Fn-2(n>

2),writeafunctiontogenerateandprintfirstnFibonaccinumbers.

stdlib.h>

inta=1,b=1,sum;

intn,i;

n);

%d\n%d\n"

a,b);

for(i=3;

=n;

sum=a+b;

b=a;

a=sum;

if(i%1==0)printf("

sum);

i++;

WriteaprogramtoproducethealphabetsetAtoZandthensaveditintoafile.

FILE*fp;

charch,filename[10];

输入文件名:

%s"

filename);

if((fp=fopen(filename,"

w"

))==NULL)

printf("

error\n"

exit(0);

for(ch='

;

ch>

='

ch<

ch++)

fputc(ch,fp);

putchar(ch);

fclose(fp);

putchar(10);

Readaseriesofcharacterfromkeyboardandwriteittofile,readfileagaintodisplayitonscreen.

ch=getchar();

输入一行字符回车结束:

while((ch=getchar())!

\n'

r"

chara;

while(!

feof(fp))

a=fgetc(fp);

putchar(a);

Inputonestringfromkeyboardandusepointertocalculatetolengthofstring

string.h>

chara[20];

char*p=a;

a);

inti=0;

while(*p!

p++;

i++;

i);

Giveonestringsandusepointertocopythisstringtoanother.

chara[20],b[20];

char*from=a,*to=b;

for(;

*from!

*to=*from;

from++,to++;

*to='

b);

Write1to20toafile,readitandputthesumofthesenumberattheendoffile.

FILE*f;

intb[20],j,sum=0;

for(j=0;

j<

20;

j++)

b[j]=j+1;

sum=sum+b[j];

chara[10];

输入文件名:

if((f=fopen(a,"

error"

fprintf(f,"

b[j]);

fprintf(f,"

sum);

fclose(f);

Usemalloc()functiontoallocate10intunitsto10numbersandprintitfrom6thnumberusingpointer.

malloc.h>

#definelensizeof(int)

int*p[10];

inta[10],i;

for(i=0;

i<

10;

i++)

scanf("

&

p[i]=(int*)malloc(len);

*p[i]=a[i];

for(i=5;

*p[i]);

Writeafunctionwithtwointegernumberargumentsandtwopointerargumentstocalculatetwonumbersumanddifference,returnthesumanddifferencewithtwopointerstocallingfunction.

intf(int*p1,int*p2);

intg(int*p1,int*p2);

inta,b;

int*p1,*p2;

p1=&

a,p2=&

b;

%d%d"

a,&

b);

%d\n%d"

f(p1,p2),g(p1,p2));

intf(int*p1,int*p2)

intsum;

sum=*p1+*p2;

returnsum;

intg(int*p1,int*p2)

intdif;

dif=*p1-*p2;

returndif;

Usingpointertoreadanarrayofintegerandprintitselementsinreverseorder

intn,c,d,a[100],b[100];

Enterthenumberofelementsinarray\n"

Enterthearrayelements\n"

for(c=0;

c<

n;

c++)

a[c]);

for(c=n-1,d=0;

c>

=0;

c--,d++)

b[d]=a[c];

n;

a[c]=b[c];

Reversearrayis\n"

a[c]);

运算符与表达式:

1.constant常量

2.variable变量

3.identify标识符

4.keywords关键字

5.sign符号

6.operator运算符

7.statement语句

8.syntax语法

9.expression表达式

10.initialition初始化

11.numberformat数据格式

12declaration说明

13.typeconversion类型转换

14.define、definition定义

条件语句:

1.select选择

2.expression表达式

3.logicalexpression逻辑表达式

4.Relationalexpression关系表达式

5.priority优先

6.operation运算

7.structure结构

循环语句:

1.circle循环

2.condition条件

3.variant变量

4.process过程

数组:

1.array数组

2.reference引用

3.element元素

4.address地址

5.sort排序

6.character字符

7.string字符串

8.application应用

函数:

1.call调用

2.returnvalue返回值

3.function函数

4.declare声明

5.`parameter参数

6.static静态的

7.extern外部的

指针:

1.pointer指针

2.argument参数

3.array数组

4.declaration声明

5.represent表示

6.manipulate处理

结构体、共用体、链表:

1structure结构

2member成员

3tag标记

4function函数

5enumerate枚举

6union联合(共用体)

7create创建

8insert插入

9delete删除

10modify修改

文件:

1、file文件

2、open打开

3、close关闭

4、read读

5、write写

6、error错误

序号主要章节常用英汉对照词汇备注

1运算符与表达式

(operatorandexpression)汉语英语

常量constant

变量variable

标识符identify

关键字keywords

符号sign

运算符operator

语句statement

语法syntax

表达式Expression

初始化Initialization

数据格式numberformat

说明Declaration

类型转换typeconversion

定义Define、definition

2条件语句

(condition

statement)选择select

表达式expression

逻辑表达式logicalexpression

关系表达式Relationalexpression

优先priority

运算operation

结构structure

3循环语句

(circlestatement)循环circle

条件condition

变量variant

过程process

4函数

(function)调用call

返回值returnvalue

函数function

声明declare

参数parameter

静态的static

外部的extern

5数组和指针

(arrayand

pointer)数组array

引用reference

元素element

地址address

排序sort

字符character

字符串string

应用application

指针pointer

参数argument

数组array

声明declaration

表示represent

处理manipulate

6结构体、

共用体

(structures、union)结构structure

成员member

标记tag

枚举enumerate

联合(共用体)union

创建create

插入insert

删除delete

修改modify

7文件

(file)文件file

打开open

关闭close

读read

写write

错误error

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2