默认参数
#include
#include <time.h>
using namespace std;
void weatherCast(string weather=sunny)
{
time_t t =time(0);//1970.0.0.0
char tmp[64];
strftime(tmp, sizeof(tmp), “%Y%m%d %X %A”,localtime(&t));
cout << tmp<<"today is weather";
}
int main()
{
weatherCast();
weatherCast();
weatherCast(“windy”);
return 0;
}