您的位置:首页 > 编程语言

算法(第四版 Robert Sedgewick)课后练习答案 1.1 基础编程模型

2013-07-14 18:20 609 查看
实在找不到课后答案,自己做了一份。

发到博客,是希望能有朋友帮我指出错误,和我一起研究这本书。

能遇到共同前行的朋友,将是我坚持下去的最大动力。

1.1.1

7

200.0000002

ture

1.1.2

1.618 double

10.0 double

true boolean

33 string

1.1.3

public class threeParEqual {
	public static void main(String[] args) {
		double a = Double.parseDouble(args[0]);
		double b = Double.parseDouble(args[1]);
		double c = Double.parseDouble(args[2]);
		if(a==b&&b==c){
			System.out.println("equal");
		}
		else System.out.println("not equal");
	}
}


1.1.4

a.java 中 if 不和 then 搭配使用

b.a>b 没加括号

c.没问题

d.c=0后应该有分号

1.1.5

public static void main(String[] args) {
		double x = Double.parseDouble(args[0]);
		double y = Double.parseDouble(args[1]);
		if(x>0&&x<1&&y>0&&y<1){
			System.out.println("true");
		} else
		System.out.println("false");
	}
1.1.6

0

1

1

2

3

5

8

13

21

34

55

89

144

233

377

610

1.1.7

a.3.00009

b.499500

c.10000

1.1.8

b

197 Java中涉及byte、short和char类型的运算操作首先会把这些值转换为int类型,然后对int类型值进行运算

e

1.1.9

书中提供答案
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: