-3

I am learning to code with c++. I recently made a magic 8 ball script. I was wondering, when people share .exe files with others. Is it possible to write a command so that the .exe file won't work after a week?

I have not tried it, because I do not know where to start.

  • 1
    A program can check the date on the computer and exit if it is too late, but the owner/administrator can set the date on the computer to any date they want. – Eric Postpischil Jun 27 '19 at 00:31

1 Answers1

0

You can get the current date and time using ctime library and if it crosses certain date, you can prevent the execution using simple if-else block.

Refer: https://www.geeksforgeeks.org/c-program-print-current-day-date-time/

Hope it helps!

AdityaSrivast
  • 1,028
  • 1
  • 10
  • 16