c调试问题

py788 2006-11-19 09:21:57
输入年龄如:1988,08,08
在16-35岁之间的合格,年龄截止日期2002,03,30
代码如下:
#include "stdio.h"
main()
{int a,b,c;
printf("shu ru ge shi wei : 1988,08,08\n");
printf("qing an gui ding chu sheng ri qi:\n");
scanf("%d,%d,%d",&a,&b,&c);
if((a<1967||a>1986)||(a>1967&&a<1986&&b<1&&b>12)||(a>1967&&a<1986&&c<1&&c>31))
printf("shu ru you wu!a\n");
{if(a==1967||a==1986)
if (a==1967)
{if(b<3)printf("shu ru you wu!b\n");}
{if(b==3&&c<30)
printf("shu ru you wu!c\n");}
else printf("nin de zi liao lu ru zhong...\na");}
if (a==1986)
{if(b>3) printf("shu ru you wu!d\n");
{if(b==3&&c>30) printf("shu ru you wu!e\n");}
else printf("nin de zi liao lu ru zhong...\na");}
}

请求帮助,谢谢
...全文
231 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lbaby 2006-11-19
  • 打赏
  • 举报
回复
人家的意思是2002,03,30以后出生的人无效。。。
bachelorkang 2006-11-19
  • 打赏
  • 举报
回复
我也感觉楼主逻辑混乱,不知道说的什么意思。
jixingzhong 2006-11-19
  • 打赏
  • 举报
回复
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
int a,b,c, flag=1;
printf("Please input a date, like \"1988,08,08\"\n");
printf("The date is(exactly as the same style as the example):\n");
scanf("%d,%d,%d",&a,&b,&c);
if( (a<1967||a>2002) ||
(b<1||b>12)||
(c<1&&c>31))
{flag=0;printf("The date is not a right date number!\n");}
else
{
if( ( (b!=2)&& ((b<8)&&(b%2==0)) || ((b>7)&&(b%2==1))) && c==31 )
{flag=0;printf("The date is not a right date number!\n");}
if((b==2)&&((a%4==0)&&(a%100!=0) || (a%400==0)) && c>28)
{flag=0;printf("The date is not a right date number!\n");}
if((b==2)&&(!((a%4==0)&&(a%100!=0) || (a%400==0)))&&c>29)
{flag=0;printf("The date is not a right date number!\n");}
}
if(flag)printf("Loading the information ...");
system("pause");
return 0;
}
jixingzhong 2006-11-19
  • 打赏
  • 举报
回复
逻辑混乱啊 !!
jixingzhong 2006-11-19
  • 打赏
  • 举报
回复
if((a<1967||a>1986)||(a>1967&&a<1986&&b<1&&b>12)||(a>1967&&a<1986&&c<1&&c>31))

条件判断有误 ~

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧