面向对象程序设计上机练习三(有默认参数的函数)
来源:互联网 发布:上海游奇网络老板 编辑:程序博客网 时间:2024/06/05 23:49
Problem Description
利用默认参数的函数实现求2个或3个整数的最大值。
Input
输入3个int型整数。
Output
输出第1、2个整数及其最大值;
输出第1、2、3个整数及其最大值。
Example Input
88 66 99
Example Output
88 66 88
88 66 99 99
code
#include <iostream>using namespace std;void max(int x,int y, int z = 0){ int m = x; if(m < y) m = y; if(m < z) m = z; cout << m << endl;}int main(){ int a,b,c; cin >> a >> b ; cout << a <<" "<< b <<" "; max(a,b); cin >> c; cout << a << " " << b << " "<< c << " "; max(a,b,c); return 0;}
阅读全文
0 0
- sdut 面向对象程序设计上机练习三(有默认参数的函数)
- 【1142】面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- SDUT1442面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- C++ 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 1142-面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- 面向对象程序设计上机练习三(有默认参数的函数)
- SDUT-1142 面向对象程序设计上机练习三(有默认参数的函数)
- 1142 面向对象程序设计上机练习三(有默认参数的函数)
- Spring AOP之通知(advice),连点(connetDoint),切点(pointcut),切点(aspect)
- 数据结构(Date Structures)
- 前缀树的实现
- 动态联动_Port
- length、lengthn、lengthc、lengthm用法介绍
- 面向对象程序设计上机练习三(有默认参数的函数)
- 实验一
- selenium鼠标定位问题
- Java中JFreeChart图表库的使用
- MT 104 Direct Debit and Request for Debit Transfer Message直接借记和请求借记转账电文
- 例题6-19 自组合(Self-Assembly, ACM/ICPC World Finals 2013, UVa 1572)
- 策略模式实现(验证)
- 排序算法-归并排序
- 2017.09.21工作日记