第二章 复习题
1.c++程序的模块叫函数
2.#include <iostream>编译指令的作用是:在最终编译之前,使用iostream文件的内容替换该编译指令
3.使得程序可以使用std名称空间中的定义
4.cout<<"hello,world\n";或cout<<"hello,world"<<endl;
5.int cheeses;
6.cheeses = 32;
7.cin>>cheeses;
8.cout<<"we have"<<cheeses<<"varieties of cheese,"<<endl;
9.调用函数froop()时应该提供一个参数,该参数的返回类型为double,而该函数将返回一个int值。例如,可以像下面这样使用它:
int gval = froop(3.14)
void rattle(int n):rattle()函数可以接受以个int定义的整型变量,并且不返回值
例如:rattle(2);
int prune(void):prune()函数可以不接受任何参数,但是会返回一个int定义的整型值。
可以这样使用 int residue = prune()
10.当函数的类型为void类型时,即使用没有返回值的函数。
11.问题原因:没有使用相应的名称空间
解决方法1:在main()函数之前使用using namespace std;
解决方法2:在main()函数内部使用using namespace std;
解决方法3:在每次输出的时候使用std::cout<<