oky onna next challenge eka. C/C++ program code ekak denna date ekak dunnama (year eka 1899 ta wada wadi date ekak) weekday eka mokakda kiyala denna one.
for an Eg
Please enter the date (dd-mm-yyyy) : 30-07-2010 - user input eka
This day is Friday. - Computer response eka .
![]()
okay here is my solution
Code:
#include "stdafx.h"
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char* dayInput =NULL;
char* temp;
tm structTime;
char * days[] = { "Sunday", "Monday","Tuesday", "Wednesday","Thursday", "Friday", "Saturday"};
int _tmain(int argc, _TCHAR* argv[])
{
printf("Please enter the date (dd-mm-yyyy) :");
dayInput =(char*)malloc(11);
scanf("%s",dayInput);
temp =(char*)malloc(4);
structTime.tm_mday = atoi(strncpy(temp,dayInput,2));
dayInput = dayInput+3;
structTime.tm_mon = atoi(strncpy(temp,dayInput,2))-1;
dayInput = dayInput+3;
structTime.tm_year = atoi(strncpy(temp,dayInput,4))-1900;
mktime(&structTime);
printf("it is %s.\n",days[structTime.tm_wday]);
system("pause");
return 0;
}
Thanks



).. 




