标题:关于goto语句 能有更好的方式代替么
只看楼主
forever74
Rank: 12Rank: 12Rank: 12
来 自:CC
等 级:贵宾
威 望:49
帖 子:1636
专家分:3940
注 册:2007-12-27
得分:0 
纯粹就语法而言
  there:    if(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&(data>31))||((month==2)&&(data>29))||((month==4||month==6||month==9||month==11)&&(data>31)))
      {printf("the data error!please enter again\n");
          scanf("%d,%d,%d",&year,&month,&data);
       goto there;}
应该可以写作
while(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&(data>31))||((month==2)&&(data>29))||((month==4||month==6||month==9||month==11)&&(data>31)))
      {printf("the data error!please enter again\n");
          scanf("%d,%d,%d",&year,&month,&data);
      }

对宇宙最严谨的描述应该就是宇宙其实是不严谨的
2010-05-27 13:47
ljrainxy
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2010-5-23
得分:0 
呵呵学习了 原来这样也行
2010-05-27 20:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-308167-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.691913 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved