C++源码:缺省参数应用实例
// Example for "default parametor 缺省参数应用实例 "
#include <iostream>
using namespace std;
void defa_f1(int a,int b=1,float c=99.8,char d='p');
main()
{
cout<<" Now in main()\n";
cout<<"Now is going to call \nFUNCTION defa_f1(100) ... ...";
defa_f1(100);
}
void defa_f1(int a,int b,float c,char d)
{
int aa,bb;
float cc;
char dd;
aa=a;
bb=b;
cc=c;
dd=d;
cout<<" \n\n\n You are wellcome ! XJ ... ..\n";
cout<<"\n a="<<a<<",b="<<b<<",c="<<c<<",d='"<<d<<"'\n";
cout<<"\n aa="<<aa<<",bb="<<bb<<",cc="<<cc<<",dd='"<<dd<<"'";
}
赞 (0)