现在的位置: 首页 > 综合 > 正文

C++中函数的返回值作为函数的参数学习笔记

2014年03月24日 ⁄ 综合 ⁄ 共 282字 ⁄ 字号 评论关闭

函数的返回值作为函数的参数使用:

#include <iostream>

int test(int x,int y);
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
	int x=5,y=6;
	//函数的返回值作为函数的参数 
	cout <<test(y,test(x,y))<<endl;
	return 0;
}

int test(int x,int y)
{
	return x>y?x:y;
}

 

抱歉!评论已关闭.