Also is there a way to display the time only instead of the date? How will i change the program to display the time in standard 12 hours, instead of 24 hours?
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
time_t tim;
time(&tim);
cout << ctime(&tim);
}