文章标题
来源:互联网 发布:sql select from 嵌套 编辑:程序博客网 时间:2024/06/06 08:55
//
// main.m
// Class05_C
//
// Created by dllo on 15/11/30.
// Copyright © 2015年 dllo. All rights reserved.
//
import
import “Function.h”
import “DealArray.h”
//第一步:导入头文件 //导入自定义类的.h文件 //注意 : 选择"",系统文件用<>
pragma mark - 知识点 1 函数的基本概念
if 1
//函数:带有某种功能的代码段
//函数的使用:通过函数的名字使用函数
//函数分为:系统函数和自定义函数
void printfLine() {
printf("_______\n");
}
// 返回值类型 函数名(形参列表) {
// 功能代码;
// }
//返回值类型:是这个函数返回值的数据类型,不可以为数组,当函数无返回值,用void表示
//函数名:函数名的命名规范和变量名的命名规范一样;
//形参列表: 把声明变量时的赋值运算符和初始值去掉,剩下的就是形参,不同形参用逗号分开
//无返回值 无形参 上面
//有返回值 无形参
// 知识点 3 函数的定义
// 一个完整的函数包含三部分 : 函数的声明,函数的实现 函数的使用
// 注意 :
// 1.函数声明必须实现
// 2.函数声明中的形参位置可以不写
// 3.在函数内部可以使用其他’已经’定义好的函数
int test2(int x); //可以不一样 //先到上面找声明,之后找实现
int test2(int y){
return y;
}
void test3(); //递归
void test3(){
test3();
}
int count();
int count() {
int num = 100;
return num;
}
//无返回值 有形参
void test();
void test(int x ,int y){
printf(“%d %d\n”, x, y);
}
//有返回值 有形参
int maxValue2(int a, int b);
int maxValue2(int a, int b) {
int max = a > b ? a : b;
return max;
}
int maxValue3(int a ,int b ,int c );
int maxValue3(int a ,int b ,int c ){
// printf(“输入三个数”);
// scanf(“%d%d%d”,&a , &b, &c);
int max = a > b ? a : b;
max = max > c ? max : c;
int min = a < b ? a : b;
min = min < c ? min : c;
// int z = (a + b + c - max - min);
return max;
}
int max001(int a,int b , int c , int d);
int max001(int a,int b , int c , int d) {
return 0;
}
int maxValue03();
int maxValue03(int a , int b ,int c){
int max = maxValue2(a, b) > c ? maxValue2(a, b) : c;
return max;
}
int maxValue04(int a,int b , int c , int d);
int maxValue04(int a,int b , int c , int d) {
return 0;
}
//当函数有返回值时,发生作用的return只能为1个
//return 后面的代码不会发生作用
//return 后面的类型要和函数的返回值一致
//return 把函数的结果返回给函数调用的位置
endif
int main(int argc, const char * argv[]) {
// printfLine();
// int a = count();
// printf(“%d\n”,a);
// test(3, 4);
// int b = maxValue2(99 , 4);
// printf(“%d\n”,b);
//
//
//
// he(3,3);
// cha(3,3);
// shang(3,3);
// ji(3,3);
// printf(“%d\n”,ji(3,3));
// printf(“%d\n”,jiecheng(4));
int arr[10] = {};int count = sizeof(arr) / sizeof(arr[0]);suiArray(arr,count);shuchu(arr,count);printf("最大值: %d\n",arraybestsum(arr,count));printf("最小值: %d\n",arraylastsum(arr,count));return 0;
}
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 数据段描述符和代码段描述符(一)——《x86汇编语言:从实模式到保护模式》读书笔记10
- ZooKeeper3.4.6学习笔记(一)集群配置
- hdu 1874 畅通工程续
- Windows下使用Hadoop2.6.0-eclipse-plugin插件
- 53.Unique Paths(动态规划)
- 文章标题
- ios开发出现fatal error: unexpectedly found nil while unwrapping an Optional value
- hash+dp打印路径 Codeforces615C Running Track
- NodeJS in Visual Studio
- Android自定义View和ViewGroup——总结于Dave Smith的视频
- H264之ffmpeg解码
- 【HTML/XML 4】实例分析HTML和XML的不同
- vector<KeyPoint> vecKeyPoints 的数据结构
- 进程调度相关命令解析