Random Thoughts XXIX

Status
Not open for further replies.
It'd be cooler if it was. Having no sex life of my own to spice things up with, I have to live vicariously.
 
Is that code?

c++?

#include <stdio.h>
#include <time.h>

int main(){
time_t rawtime;
struct tm *timeinfo;
int year, month ,day;
char buffer[64]="";

/* prompt user for date */
printf("\\nEnter year (number): "); scanf("%d",&year);
printf("\\nEnter month (number): "); scanf("%d",&month);
printf("\\nEnter day (number): "); scanf("%d",&day);

/* get current timeinfo and modify it to the user's choice */
time(&rawtime);
timeinfo = localtime(&rawtime);
timeinfo->tm_year = year - 1900;
timeinfo->tm_mon = month - 1;
timeinfo->tm_mday = day;

/* call mktime: timeinfo->tm_wday will be set */
mktime(timeinfo);

/* display the weekday (this is a fix for the deprecated conversion to char*) */
strftime(buffer,64,"That day is a %A",timeinfo);

printf("\n%s\n", buffer);

return 0;
}
 
c++?

#include <stdio.h>
#include <time.h>

int main(){
time_t rawtime;
struct tm *timeinfo;
int year, month ,day;
char buffer[64]="";

/* prompt user for date */
printf("\\nEnter year (number): "); scanf("%d",&year);
printf("\\nEnter month (number): "); scanf("%d",&month);
printf("\\nEnter day (number): "); scanf("%d",&day);

/* get current timeinfo and modify it to the user's choice */
time(&rawtime);
timeinfo = localtime(&rawtime);
timeinfo->tm_year = year - 1900;
timeinfo->tm_mon = month - 1;
timeinfo->tm_mday = day;

/* call mktime: timeinfo->tm_wday will be set */
mktime(timeinfo);

/* display the weekday (this is a fix for the deprecated conversion to char*) */
strftime(buffer,64,"That day is a %A",timeinfo);

printf("\n%s\n", buffer);

return 0;
}

If that doesn't translate to porn, I'm disappointed in you.
 
I don't understand people who run for fun. If I'm running, it's because I'm trying to catch up to the ice cream truck.
 
  • Like
Reactions: 1 person
Haha. News just reported a cadillac recall because the wheels might fall off.
 
Status
Not open for further replies.
Advertisement





Back
Top