1

I want to write a C++ code for checking if the person is above 18 yrs old but not by asking the age but by the DOB of the person. Is there any way which can help me in getting the current Date from the system?

1

1 Answer 1

2
#include <iostream> #include <ctime> void printTime() { time_t t = time(0); struct tm * timeStruct = localtime(&t); std::cout << (timeStruct->tm_year) << '-' << (timeStruct->tm_mon) << '-'<< (timeStruct->tm_mday) << std::endl; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.