| | |
Date Alert Reminder
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2005
Posts: 10
Reputation:
Solved Threads: 0
Hi...Im trying to make a date reminder type program...But Im looking for something along the lines of If(date == 31102005){*code*....May I please have help with this?? This is what i did...But is totally wrong...I need something that checks the date...where the user does not enter data.
C Syntax (Toggle Plain Text)
#include <stdio.h> #include <windows.h> #include <time.h> int main(void) { int day, month, year; if (day == 31 & month == 10 & year == 2005) { system("Echo Happy Halloween!"); } return(0); }
see the ansi time() function, decribed in the C time.h header file.
Here is my code, in C :
Here is my code, in C :
C Syntax (Toggle Plain Text)
#include <stdlib.h> #include <stdio.h> #include <time.h> /**retrieves the current date. * the given parameters are filled with the current time values */ void retrieve_time(int* day, int* month, int *year) { time_t t=time(NULL); struct tm* timeinfo=localtime(&t); *day=timeinfo->tm_mday; *month=timeinfo->tm_mon+1;/*junuary->1 december->12*/ *year=timeinfo->tm_year+1900; } int main(void) { int day, month, year; retrieve_time(&day, &month, &year); if(day==31 && month==10 && year==2005) { printf("happy halloween 2005 !\n"); } return EXIT_SUCCESS; }
![]() |
Similar Threads
- Display client's PC Date & Time (ASP.NET)
- Virus ALert! (Viruses, Spyware and other Nasties)
- Error while trying the update query (ASP)
- Check existing users in the database (ASP)
- Error: Expected ')' (Site Layout and Usability)
Other Threads in the C Forum
- Previous Thread: The Powers Of Two
- Next Thread: Time Release Message Box
Views: 2293 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C
#include * .net append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft mqqueue mysql number oddnumber odf opensource overwrite owf pdf performance pointer pointers posix probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi





