泛型编程与C标准库Word文档下载推荐.docx

上传人:b****2 文档编号:14131989 上传时间:2022-10-19 格式:DOCX 页数:31 大小:62.35KB
下载 相关 举报
泛型编程与C标准库Word文档下载推荐.docx_第1页
第1页 / 共31页
泛型编程与C标准库Word文档下载推荐.docx_第2页
第2页 / 共31页
泛型编程与C标准库Word文档下载推荐.docx_第3页
第3页 / 共31页
泛型编程与C标准库Word文档下载推荐.docx_第4页
第4页 / 共31页
泛型编程与C标准库Word文档下载推荐.docx_第5页
第5页 / 共31页
点击查看更多>>
下载资源
资源描述

泛型编程与C标准库Word文档下载推荐.docx

《泛型编程与C标准库Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《泛型编程与C标准库Word文档下载推荐.docx(31页珍藏版)》请在冰豆网上搜索。

泛型编程与C标准库Word文档下载推荐.docx

1.a.void,double,return

b.printf

c.MAX_ENTRIES,G

d.time,xyz123,this_is_a_long_one

e.Sue'

s,part#2,"

char"

#include

3.预处理器,#define和#include

2.2节

1.a.0.01031234500.0123450.0

b.1.3e+31.2345e+24.26e-3

3.double,int,char

2.3节

1.Entertwointegers>

57

m=10

n=21

3.MynameisJaneDoe.

IliveinAnnArbor,MI

andIhave11yearsofprogrammingexperience.

2.4节

1./*Thisisacomment?

*/

/*Thisoneseemslikeacommentdoesn’tit*/

2.5节

1.a.22/7为37/22为022%7为17%22为7

b.16/15为115/16为016%15为115%16为15

c.23/3为73/23为023%3为23%23为3

d.16/-3为?

?

-3/16为?

16%-3为?

-3%16为?

(?

意为结果是变化的)

3.a.3g.未定义m.-3.14159

b.?

h.未定义n.1.0

c.1i.?

o.1

d.-3.14159j.3p.未定义

e.?

k.-3.0q.3

f.0.0l.9r.0.75

(?

5.a.white为1.6666…c.orange为0e.lime为2

b.green为0.6666…d.blue为-3.0f.purple为0.0

2.6节

1.printf("

Salaryis%10.2f\n"

salary);

3.x■is■■12.34■■i■is■100

i■is■100

x■is■12.3

2.7节

1.在调用scanf获得数据之前先调用printf显示提示。

当调用scanf后有数据回应时调用printf。

提示用于交互式程序而不用于批处理程序。

批处理程序应该回显输入,交互程序也可以回显输入。

第3章

3.1节

1.问题输入

doublehours/*numberofhoursworked*/

doublerate/*hourlyrateofpay*/

问题输出

doublegross/*grosssalary*/

算法

(1)输入工作时间hours和每小时所付的工资率rate。

(2)计算总工资gross。

2.1把hours*rate的值赋给gross。

(3)显示总工资gross。

3.问题输入

doublereg_hours/*numberofregularhoursworked*/

doubleot_hours/*numberofovertimehoursworked*/

doublerate/*hourlyrateofpay*/

doublegross/*grosssalary*/

(1)输入常规工作时数(reg_hours)、加班时数(ot_hours)和每小时所付工资比率rate。

2.1将reg_hours*rate的值赋给gross。

2.2前一步gross的值再加上ot_hours*1.5*rate。

3.2节

1.a.sqrt(u+v)*pow(w,2)

b.log(pow(x,y))

c.sqrt(pow(x–y,3))

d.fabs(x*y–w/z)

3.3节

1.设计阶段

3.4节

1.HIMOM被用较大的印刷体字母垂直地输出。

3.5节

1.a.3141.590000

b.31.415900

c.***********

**

*31.42*

***********

d.3.141590

e.3.141590

3.函数参数被用来在一个程序的各个模块之间、主程序与其模块之间传递信息。

参数使函数更容易被其他函数或程序复用。

带参数的函数是建造更大程序的基石。

第4章

4.2节

3.x=3.0y=4.0z=2.0flag=0

!

(flag||(y+z>

=x–z))

04.02.03.02.0

6.01.0

1

0

1.1(TRUE)

0(FALSE)

1(TRUE)

5.ans为2。

4.3节

1.a.notless

b.greaterthan

4.4节

1.if(x>

y){

x=x+10.0;

printf("

xBigger\n"

);

}else{

xSmaller\n"

yis%.2f\n"

y);

}

3.if(engine_type=='

J'

){

Jetengine"

speed_category=1;

Propellers"

speed_category=2;

4.5节

1.额外的程序常量:

CAP_GALLONS100/*maximumnumberofgallons(inthousands)forbasicfee*/

额外的程序变量:

intexcess/*numberofgallonsoverCAP_GALLONS*/

comp_use_charge的改写算法:

(1)used为current–previous

(2)ifused>

CAP_GALLONS

excess为used–GAP_GALLONS

use_charge为CAP_GALLONS*PRE_1000_CHG+

excess*PER_1000_CHG*2

else

use_charge为used*PER_1000_CHG

4.7节

1.

语句部分

工资

结果

if(salary<

0.0)

23500.00

23500.00<

0.00为假

elseif(salary<

15000.00)

15000.00为假

30000.00)

30000.00为真

tax=(salary–15000.00)

求解为8500.00

*0.18

求解为1530.00

+2250.00

3780.00

求解为3780.00

3.if(pH>

7)

if(pH<

12)

Alkaline"

Veryalkaline"

elseif(pH==7)

Neutral"

elseif(pH>

2)

Acidic"

Veryacidic"

4.8节

1.red

blue

yellow

第5章

5.1节

1.a.计数循环

(1)初始化sum为0。

(2)设置lcv为0。

(3)whilelcv<

35

(4)获得下一个考试成绩。

(5)把考试成绩与sum相加。

(6)把lcv的值加1。

3.控制文件结束的循环

(1)初始化count为0。

(2)获得第一个温度并存储输入状态。

(3)while输入状态并不表示已到达文件末尾

(4)if温度>

100,count加1;

(5)获得下一个温度并存储输入状态。

5.2节

1.010

19

28

37

46

55

5.3节

1.a.Enteraninteger>

5

25

125

625

b.Enteraninteger>

6

36

216

1296

c.Enteraninteger>

7

7

49

343

2401

一般地,该循环显示n,n2,n3和n4。

3.count=0;

sum=0;

while(count<

5){

Nextnumber>

"

scanf("

%d"

&

next_num);

sum+=next_num;

count+=1;

%dnumberswereadded;

count);

theirsumis%d.\n"

sum);

5.4节

1.当n=8时:

语句

add

sum

作用

sum=0;

初始化sum为0

odd=1;

1

初始化odd为1

odd<

n;

1<

8为真

sum+=odd;

sum=0+1

odd+=2

3

odd=1+2

3<

8为真

4

sum=1+3

5

odd=3+2

5<

sum+=odd;

9

sum=4+5

7

odd=5+2

7<

16

sum=9+7

odd+=2

odd=7+2

odd

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

当前位置:首页 > PPT模板 > 卡通动漫

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

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