[ create a new paste ] login | about

Link: http://codepad.org/6G1pGwHG    [ raw code | output | fork ]

hecomi - C++, pasted on Dec 15:
#include <iostream>
#include <string>
#include <ctime>
using namespace std;

string eveAdder(string str, double rest)
{
  return (rest > 0) ? eveAdder(str+"イブ", rest-60*60*24) : str;
}

int main()
{
  time_t present, xmas;
  struct tm *tmPresent, tmXmas = {0};

  present = time(NULL);
  tmPresent = localtime(&present);

  tmXmas.tm_mday = 25;
  tmXmas.tm_mon  = 11;
  tmXmas.tm_year = tmPresent->tm_year;

  xmas = mktime(&tmXmas);

  cout << eveAdder("クリスマス", difftime(xmas, present)) << endl;

  return 0;
}


Output:
1
クリスマスイブイブイブイブイブイブイブイブイブイブ


Create a new paste based on this one


Comments: