有谁知道该怎么做?!参数问题
以下程序非常简单,maxmin函数返回输入参数中较大的数值
问题是在main函数中step1、2、3(见main内注释)都能正常通过,我想让step4正常通过,可我不想填第一个参数,只想修改第二个参数,怎么做?step4在VC++6中不能编译通过。请教啦
// maxmin.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int maxmin(int i = 1, int j = 1)
{
if (i > j)
return i;
else
return j;
}
int main(int argc, char* argv[])
{
int i;
//step1
i = maxmin();
printf("Number is %d\r\n", i);
//step2
i = maxmin(2);
printf("Number is %d\r\n", i);
//step3
i = maxmin(2,3);
printf("Number is %d\r\n", i);
//step4
i = maxmin(,4);
printf("Number is %d\r\n", i);
return 0;
}