Absolute C++ Chapter 5 Self-Test Exercise(1)

本文通过具体的C++代码示例介绍了数组的声明及使用方法,并展示了如何通过for循环来读取数组元素。文中还涉及了数组越界等常见错误,为初学者提供了实用的学习材料。

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 error

4.abc

5.

1.1 2.2 3.3

1.1 3.3 3.3

6.

0 2 4 6 8 10 12 14 16 18

0 4 8 12 16

7. there is no place 9 for the array.

8. at the end there is no a[10] variable.

9.

int a[20]

for(int i=0,i<20,i++)
{
  cin<<a[i];
}

10. 14,1006

11.tripler(a[3]); tripler(a); are illegal

12.b[5] does not exist.

 

转载于:https://www.cnblogs.com/hanterry/archive/2012/05/09/2491039.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值