摘要:
#includeusing namespace std;/* 函数的声明,作用是提前告诉编译器函数的存在 函数声明可以有多次(但一般写一次就行),函数定义只能有一次*///函数声明int get_max_1(int a, int b);//函数定义... 阅读全文
摘要:
#includeusing namespace std;/* 常见函数样式: 无参无返 有参无返 无参有返 无参无返*/// 1void test1(){ cout << "this is test1" << endl;}/... 阅读全文
摘要:
#includeusing namespace std;/* 函数定义5个要点: 返回值类型 函数名 参数列表 函数体语句 return表达式 返回值类型 函数名(参数列表){ 函数体语句 ... 阅读全文
摘要:
#includeusing namespace std;/* 综合案例:指针+数组+函数 封装一个函数,利用冒泡排序,实现对整型数组的升序排列*/void bubble_sort(int * arr, int len){ // 形参指针arr接收数... 阅读全文
摘要:
#includeusing namespace std;void swap1(int a, int b){ int temp = a; a = b; b = temp; cout << "swap1 a=" << a << endl; ... 阅读全文
摘要:
#includeusing namespace std;int main(){ /* 指针的定义和使用 */ int a = 10; //定义指针:数据类型 * 指针变量名 int * p; //让指针记录变量... 阅读全文
摘要:
#includeusing namespace std;int main(){ /* 指针和数组 */ int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; cout << "数组第... 阅读全文