设为首页 加入收藏

TOP

函数的重载
2017-07-12 10:23:13 】 浏览:2835
Tags:函数 重载

//函数的重载

//函数名相同时,三个要点:1、形参的数量不同 2、形参的类型不同 3、形参数量和类型都不同

//但是在C中,每个函数都必须有唯一的一个名字,这个就必须记住每一个函数的名字。

#include

using namespace std;

int min(int, int);

char min(char, char);

double min(double, double, double);

int main()

{

int a=2, b=4, m;

char i='e', j='g', n;

double c=11.11, d=12.12, e=13.13, p;

m= min(a,b);

cout<<"min="< n= min(i,j);

cout<<"min="< p= min(c, d, e);

cout<<"min="< return 0;

}

int min(int x, int y)

{

return x }

double min(double x, double y, double z)

{

double temp;

temp= x return temp }

char min(char x, char y)

{

return x }

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇k进制下的大数 字符串取模 下一篇字符串对象的创建

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目