摘要: 1. int a[5] is a declaration of array that has 5 places for int value, but a[4] is the fifth variable of array [a]2.a.score b.double c.5 d.0-5 e.score[1]3.a. too many argument assigned. b. no error c. no error4.abc5.1.1 2.2 3.31.1 3.3 3.36.0 2 4 6 8 10 12 14 16 180 4 8 12 167. there is no place 9 fo 阅读全文
posted @ 2012-05-09 00:27 terryhan 阅读(137) 评论(0) 推荐(0)
摘要: 1.A call-by-value parameter is a local variable. When the function is invoked, the value of a callby-value argument is computed and the corresponding call-by-value parameter (which is alocal variable) is initialized to this value.2.yes3.10 20 301 2 31 20 34. the first won't change to the second, 阅读全文
posted @ 2012-05-08 01:17 terryhan 阅读(148) 评论(0) 推荐(0)
摘要: 15.HelloGoodbyeOne more timeHelloEnd of program16.It will occur an error only there is 0 person to divide to ice-cream.17.#include<iostream>using namespace std;void product(int num1,int num2,int num3);int main(){ cout<<"Give me 3 integers." cin>>num1>>num2>>nu 阅读全文
posted @ 2012-05-07 19:02 terryhan 阅读(121) 评论(0) 推荐(0)
摘要: 7.Wow8.int sum(int firstNum,int secNum,int thirdNum);int sum(int firstNum,int secNum,int thirdNum){ sumall=firstNum+secNum+thirdNum; return sumall}9.char determine(double parameter);char determine(double parameter){ if(parameter>0) return 'P'; else return 'N';}10.No11.You got to i 阅读全文
posted @ 2012-05-07 14:33 terryhan 阅读(128) 评论(0) 推荐(0)
摘要: 1.16.01/2 161/2 2.03.023 2.03 1.12|3| |-3| |0||-3.0| |-3.5| |3.5|2.sqrt(x+y) pow(x,y+7) sqrt(area+fudge)sqrt(time+tide)/nobody (-b+sqrt(pow(b,2)-4*a*c))/(2*a)abs(x-y)3.#include<iostream>#include<cmath>using namespace std;int main(){ for(int i=1,i<=10,i++) { root=sqrt(i); cout<<. 阅读全文
posted @ 2012-05-07 10:38 terryhan 阅读(184) 评论(0) 推荐(0)
摘要: 27.2 4 6 828.Hello 10Hello 8Hello 6Hello 4Hello 229.2.000000 1.500000 1.000000 0.50000030.a.for(int i=1;i<=10;i++){ if(i<5&&i!=2) cout<<'X';}b.for(int i=1;i<=10;i+=3) cout<<'X';c.for(long n=100;n<=1000;n+=100) cout<<'X';31.1024 11024 2102 阅读全文
posted @ 2012-05-06 21:07 terryhan 阅读(147) 评论(0) 推荐(0)
摘要: 16.3 2 1 017.2 1 7 518.2 1 019.2 120.1 2 3 421.1 2 322.1074123. the program won't do anything.24.1074125.-4226.do-while statement will execute at least once 阅读全文
posted @ 2012-05-06 02:32 terryhan 阅读(148) 评论(0) 推荐(0)
摘要: 11.StartHello from the second ifEndStart againEnd again12.large13.small14.medium15.if(n<0) cout<<n<<"is less than 0. \n";else if((n>=0)&&(n<=100)) cout<<n<<" is between 0 and 100 \n";else cout<<n<<"is greater than 100 \n&q 阅读全文
posted @ 2012-05-05 19:59 terryhan 阅读(117) 评论(0) 推荐(0)
摘要: 5. No, because the compiler will evaluate the most left side bineral operation, and since c++ is using the short-circuit evaluation, so the result of the left expression is false, and within the && expression, the entire expression is false, the second operation will not be tested at all.6.i 阅读全文
posted @ 2012-05-05 19:30 terryhan 阅读(245) 评论(0) 推荐(0)
摘要: 1.a.T b.T c.T d.T e.F f.T g.F h.error i.T j.errork.F l.T2.(x>2)&&(x<3)3.(x<-1)||(x>2)4.(x>1)&&(x<3) 阅读全文
posted @ 2012-05-05 17:48 terryhan 阅读(88) 评论(0) 推荐(0)