// moren_xingcan2.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
void f(int a, int b = 2, int c = 3, int d = 4); //声明,默认形参
int _tmain(int argc, _TCHAR* argv[])
{
f(1);
f(5, 10);
f(11, 12, 13);
f(20, 30, 40,50);
getchar();
return 0;
}
void f(int a, int b, int c , int d) //函数实现
{
cout << a << " " << b << " " << c << " " << d << endl;
}
运行结果: