Subdomain Posts
None | 33 days ago
C++ | 219 days ago
C | 717 days ago
C | 717 days ago
ASM (NASM) | 719 days ago
C | 747 days ago
None | 780 days ago
None | 782 days ago
None | 784 days ago
None | 794 days ago
Recent Posts
None | 9 sec ago
None | 16 sec ago
None | 35 sec ago
Java | 40 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
Pic 16 | 2 min ago
None | 2 min ago
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Hav0c on the 24th of Mar 2008 08:51:50 AM
Download |
Raw |
Embed |
Report
#include <stdio.h>
struct data{
int day;
int month;
int year;
};
typedef struct data date;
date subs(date time,int whut,int omg)
{
if(!whut){ // if whut == 0; change day, 1 = month, 2 = year etc
if(time.day<omg) time.month--;
if(time.month<1) time.year--;
time.day -= omg;
if(time.day < 1);
// check what month it is so that if it's october for
// example, it will add 31 instead of 30
// i'm too lazy for that
time.day = 30 - omg;
}
// rest of code, but im lazy for that
return(time);
}
int main()
{
date time;
time.day = 27;
time.month = 10;
time.year = 1991;
time = subs(time,0,10);
"Month: %d\n"
"Year: %d\n"
,time.day,time.month,time.year);
return(0);
}
Submit a correction or amendment below.
Make A New Post