ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:18.33KB ,
资源ID:11823929      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/11823929.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C语言设计经典英文练习题.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C语言设计经典英文练习题.docx

1、C语言设计经典英文练习题C Practice Print 9*9 multiplication table 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 1*4=4,2*4=8,3*4=12 4*4=16 1*9=9,. 9*9=81#include int main(void) int x,y,z; for(x=1;x=9;x+) for(y=1;y=x;y+) z=x*y; printf(%d*%d=%d,y,x,z); printf(n); Calculate 1+2!+3!+20!#includeintmain()inti;longlongsum=0,jc=1

2、;for(i=1;i=20;+i)jc*=i;sum+=jc;printf(%dn,sum);return0;Input x and print y Y=2X,X0;Y=4X-2,0=X=10#include int main()float x,y;printf(Please input X:);scanf(%f,&x);if(x0)y=2*x;else if(x10)y=4*x-2;elsey=6*x*(x+3);printf(Y=%fn,y);Input a string from keyboard, write a program to calculate the number of a

3、lpha, digit space and other character.#includeint main()char str100;int i=0;int num=0,ch=0,blank=0,other=0;gets(str);while(stri!=0) if(stri=A & stri=a & stri=0 & stri=9) num+; else if(stri= ) blank+; else other+;i+; printf(数字%d个,字母%d个,空格%d个,其他%d个n,num,ch,blank,other); return 0;Read 5 integer from ke

4、yboard to sort in descending order#includeint main()int a5=0;int i,j,t;printf(请依次输入5个整数n);for(i=0;i5;i+) /输入5个数 scanf(%d,&ai);for(i=0;i5;i+) /从大到小排序 for(j=i+1;j5;j+) if(aiaj) t=ai; ai=aj; aj=t; for(i=0;i2), write a function to generate and print first n Fibonacci numbers.#include #include int main()

5、 int a=1,b=1,sum; int n,i; scanf(%d,&n); printf(%dn%dn,a,b); for (i=3;i=n;) sum=a+b; b=a; a=sum; if(i%1=0)printf(%dn,sum); i+; return 0; Write a program to produce the alphabet set A to Z and then saved it into a file. #include#includeint main() FILE *fp; char ch, filename10; printf(输入文件名:n); scanf(

6、%s, filename); if (fp = fopen(filename, w) = NULL) printf(errorn); exit(0); for (ch = A; ch = A&ch = Z; ch+) fputc(ch, fp); putchar(ch); fclose(fp); putchar(10); return 0;Read a series of character from keyboard and write it to file, read file again to display it on screen.#include#includeint main()

7、 FILE *fp; char ch, filename10; printf(输入文件名:n); scanf(%s, filename); if (fp = fopen(filename, w) = NULL) printf(errorn); exit(0); ch = getchar(); printf(输入一行字符回车结束:n); while(ch=getchar()!=n) fputc(ch, fp); putchar(ch); fclose(fp); putchar(10); printf(输入文件名:n); scanf(%s, filename); if (fp = fopen(fi

8、lename, r) = NULL) printf(errorn); exit(0); char a; if (fp = fopen(filename, r) = NULL) printf(errorn); exit(0); while (!feof(fp) a = fgetc(fp); putchar(a); fclose(fp); return 0;Input one string from keyboard and use pointer to calculate to length of string #include#includeint main() char a20; char

9、*p=a; scanf(%s, a); int i=0; while (*p != 0) p+; i+; printf(%dn, i); return 0;Give one strings and use pointer to copy this string to another.#includeint main() char a20, b20; char *from=a, *to=b; scanf(%s, a); for(;*from != 0;) *to = *from; from+, to+; *to = 0; printf(%s, b); return 0; Write 1 to 2

10、0 to a file, read it and put the sum of these number at the end of file.#include#includeint main() FILE *f; int b20, j, sum = 0; for (j = 0; j 20; j+) bj = j + 1; sum = sum + bj; char a10; printf(输入文件名:n); scanf(%s, a); if (f = fopen(a, w) = NULL) printf(error); exit(0); for (j = 0; j 20; j+) fprint

11、f(f, %d , bj); fprintf(f, %d, sum); fclose(f); return 0; Use malloc() function to allocate 10 int units to 10 numbers and print it from 6th number using pointer. #include#include#define len sizeof(int)int main() int *p10; int a10, i; for (i = 0; i 10; i+) scanf(%d, &ai); for (i = 0; i 10; i+) pi = (

12、int *)malloc(len); *pi = ai; for (i = 5; i 10; i+) printf(%d , *pi); return 0; Write a function with two integer number arguments and two pointer arguments to calculate two number sum and difference, return the sum and difference with two pointers to calling function.#includeint main() int f(int *p1

13、, int *p2); int g(int *p1, int *p2); int a, b; int *p1, *p2; p1 = &a, p2 = &b; scanf(%d %d, &a, &b); printf(%dn%d, f(p1, p2), g(p1, p2); return 0;int f(int *p1, int *p2) int sum; sum = *p1 + *p2; return sum;int g(int *p1, int *p2) int dif; dif = *p1 - *p2; return dif;Using pointer to read an array o

14、f integer and print its elements in reverse order#include int main() int n, c, d, a100, b100; printf(Enter the number of elements in arrayn); scanf(%d, &n); printf(Enter the array elementsn); for (c = 0; c = 0; c-, d+) bd = ac; for (c = 0; c n; c+) ac = bc; printf(Reverse array isn); for (c = 0; c n

15、; c+) printf(%dn, ac); return 0;运算符与表达式: 1.constant 常量 2. variable 变量 3. identify 标识符 4. keywords 关键字 5. sign 符号 6. operator 运算符 7. statement语句 8. syntax 语法 9. expression 表达式 10. initialition 初始化 11. number format 数据格式 12 declaration 说明 13. type conversion 类型转换 14.define 、definition 定义 条件语句: 1.selec

16、t 选择 2. expression 表达式 3. logical expression 逻辑表达式 4. Relational expression 关系表达式 5.priority优先 6. operation运算 7.structure 结构 循环语句: 1.circle 循环 2. condition 条件 3. variant 变量 4. process过程 5.priority优先 6. operation运算 数组: 1. array 数组 2. reference 引用 3. element 元素 4. address 地址 5. sort 排序 6. character 字符

17、 7. string 字符串 8. application 应用 函数: 1.call 调用 2.return value 返回值 3.function 函数 4. declare 声明 5. parameter 参数 6.static 静态的 7.extern 外部的 指针: 1. pointer 指针 2. argument 参数 3. array 数组 4. declaration 声明 5. represent 表示 6. manipulate 处理 结构体、共用体、链表: 1 structure 结构 2 member成员 3 tag 标记 4 function 函数 5 enume

18、rate 枚举 6 union 联合(共用体) 7 create 创建 8 insert 插入 9 delete 删除 10 modify 修改 文件: 1、file 文件 2、open 打开 3、close 关闭 4、read 读 5、write 写 6、error 错误 序号 主要章节 常用英汉对照词汇 备注 1 运算符与表达式 ( operator and expression ) 汉语 英语 常量 constant 变量 variable 标识符 identify 关键字 keywords 符号 sign 运算符 operator 语句 statement 语法 syntax 表达式

19、Expression 初始化 Initialization 数据格式 number format 说明 Declaration 类型转换 type conversion 定义 Define 、 definition 2 条件语句 ( condition statement) 选择 select 表达式 expression 逻辑表达式 logical expression 关系表达式 Relational expression 优先 priority 运算 operation 结构 structure 3 循环语句 (circle statement) 循环 circle 条件 conditi

20、on 变量 variant 过程 process 优先 priority 运算 operation 4 函数 (function) 调用 call 返回值 return value 函数 function 声明 declare 参数 parameter 静态的 static 外部的 extern 5 数组和指针 (array and pointer) 数组 array 引用 reference 元素 element 地址 address 排序 sort 字符 character 字符串 string 应用 application 指针 pointer 参数 argument 数组 array 声明 declaration 表示 represent 处理 manipulate 6 结构体、 共用体 (structures 、 union ) 结构 structure 成员 member 标记 tag 函数 function 枚举 enumerate 联合 ( 共用体 ) union 创建 create 插入 insert 删除 delete 修改 modify 7 文件 ( file) 文件 file 打开 open 关闭 close 读 read 写 write 错误 error

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1