Check for a valid date HELP!

I wanna create a program to Check for a valid date! dd/mm/yyyy
update:sorry guys,the program pops up normally,but the conditions have no effect , that mean no matter the numbers i give (like 43/12/2013) it always show me "exist" , so where is the problem?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<stdio.h>
main()
{
int a,jour,mois,annee;
printf("donner le jour: ");
scanf("%d",&jour);
printf("donner le moin: ");
scanf("%d",&mois);
printf("donner l'annee: ");
scanf("%d",&annee);
a=1;
if ((jour<1) || (jour>31) || (mois<1) || (mois>12) || (annee<1))
a=0;
else if ((mois==2) && (((annee%4!=0) || (annee%400!=0)) && (annee%400==0)) && (jour=29))
a=0;
else if ((mois=2) && ((jour==30)) || (jour==31))
a=0;
else if ((mois=4) && (jour==31))
a=0;
else if ((mois=6) && (jour==31))
a=0;
else if ((mois=9) && (jour==31))
a=0;
else if ((mois=11) && (jour==31))
a=0;
if (a=0)
printf("error!");
else
printf("existe!");
return 0;
}
Last edited on
What makes you think there is a problem? Does it cause your computer to explode? Does it send your bank account information to the guy next door? Does it get you fired from your job? You need to be specific.
You just forgot to close several parentheses, for example on line 16, 18,...
Hello

It is impossible to help you if you don't give more information

What errors do you have?

Is it compiling?
Is the output of the program incorrect?
Is it correct in some cases?
if so, which cases leads to wrong behavior?

Nobody will answer questions like, here is my code, solve all the issues, please provide more information :)

Best Regards
Topic archived. No new replies allowed.