I wanted to make an Attendance system which would take system date and time as file name of the file for ex: this is how normally it is
int main () {
time_t t = time(0); // get time now
struct tm * now = localtime( & t );
cout << (now->tm_year + 1900) << '-'
<< (now->tm_mon + 1) << '-'
<< now->tm_mday
<< endl;
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
but i want system date and time in place of example.txt i have calculated time by including ctime header file in the program above program is just example .