Absolute C++ Chapter 3 Self-Test Exercise(3)

本文详细介绍了C++编程的基础知识,包括变量、运算符、控制结构、函数定义、参数传递、作用域等核心概念,并通过具体实例展示了如何运用这些基础知识解决实际问题。

15.

Hello

Goodbye

One more time

Hello

End of program

16.

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>>num3;
  product(num1,num2,num3);
  return 0;
}
void product(int num1,int num2,int num3)
{  
  pro=num1*num2*num3;
  cout<<"the product of"<<num1<<","<<num2<<","<<num3<<" is "<<pro;
}
 

 

18.略

19.略

20.function definition

21.yes

22. Blackbox method

23.略

24.略

25.

{
int x1 = 1;// output in this column
cout << x1 << endl;// 1<new line>
{
cout << x1 << endl;// 1<new line>
int x2 = 2;
cout << x2 << endl;// 2<new line>
{
cout << x2 << endl;// 2<new line>
int x3 = 3;
cout << x3 << endl;// 3<new line>
}
cout << x2 << endl;// 2<new line>
}
cout << x1 << endl;// 1<new line>
}

 

转载于:https://www.cnblogs.com/hanterry/archive/2012/05/07/2488187.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值