标题:给大家看一个有价值的源代码
取消只看楼主
黑帽白客
Rank: 2
等 级:论坛游民
帖 子:7
专家分:20
注 册:2009-7-30
结帖率:100%
 问题点数:0 回复次数:2 
给大家看一个有价值的源代码
最近无聊啊,就到书店逛了逛,看了一下,买了一本PASCAL程序设计看看,觉得这语言不错,就认真看了几天,突发奇想地写了个没人研究过地程序,给大家看看,哪位能看懂是干嘛用的,就Q我,QQ:704339488,我喜欢和高手交朋友,看不懂的别捣乱啊

program 1(input,output);
  var
    year,month,d,h,m,s,e1,e2,zh,zd,zm,zy:integer;
    f1,f2:char;
  procedure m(h,d,e1,e2,f2,month,year;var zh,zd,zm,zy:integer);
    var
      e3,e4,zdt:integer;
    begin
      if f2='m'
        then begin
               zh:=h;
               zd:=d;
               zm:=month;
               zy:=year
             end
        else if f2='e'
               then begin
                      e3:=e2-e1;
                      zh:=h+e3;
                      if zh>24
                        then begin
                               zh:=zh-24;
                               zd:=d+1
                             end
                        else zd:=d;
                      case month of
                        1,3,5,7,8,10,12:zdt:=31;
                        4,6,9,11       :zdt:=30;
                        2              :if (year mod 4=0)
                                           and(year mod 100<>0)
                                           or(year mod 400=0)
                                           then zdt:=29
                                           else zdt:=28
                      end;{case}
                      if zd>zdt
                        then begin
                               zd:=zd-zdt;
                               zm:=month+1;
                               if zd>29
                                 then begin
                                        if zm=2
                                          then begin
                                                 zm=zm+1;
                                                 if (year mod 4=0)
                                                    and(year mod 100<>0)
                                                    or(year mod 400=0)
                                                    then zd:=zd-29
                                                    else zd:=zd-28
                                               end
                                      end;
                               if zm>12
                                 then begin
                                        zm:=zm-12;
                                        zy:=year+1
                                      end
                    end
               else if f2='b'
                      then begin
                             zh:=h+12;
                             if zh>24
                               then begin
                                      zh:=zh-24;
                                      zd:=d+1
                                    end
                               else zd:=d
                             case month of
                               1,3,5,7,8,10,12:zdt:=31;
                               4,6,9,11       :zdt:=30;
                               2              :if (year mod 4=o)
                                                  and(year mod 100<>0)
                                                  or(year mod 400=0)
                                                  then zdt:=29
                                                  else zdt:=28
                             end;{case}
                             if zd>zdt
                               then begin
                                      zd:=zd-zdt;
                                      zm:=month+1;
                                      if zd>29
                                        then begin
                                               if zm=2
                                                 then begin
                                                        zm:=zm+1;
                                                        if (year mod 4=0)
                                                           and(year mod 100<>0)
                                                           or(year mod 400=0)
                                                           then zd:=zd-29
                                                           else zd:=zd-28
                                                      end
                                             end
                                    end
                           end
                      else if f2='w'
                             then begin
                                    case e2 of
                                      11:e4:=13;
                                      10:e4:=14;
                                      9 :e4:=15;
                                      8 :e4:=16;
                                      7 :e4:=17;
                                      6 :e4:=18;
                                      5 :e4:=19;
                                      4 :e4:=20;
                                      3 :e4:=21;
                                      2 :e4:=22;
                                      1 :e4:=23
                                    end;{case}
                                    e3:=e1+e4;
                                    zh:=h+e3;
                                    if zh>24
                                      then begin
                                             zh:=zh-24;
                                             zd:=d+1;
                                           end
                                      else zd:=d
                                    case month of
                                      1,3,5,7,8,10,12:zdt:=31;
                                      4,6,9,11       :zdt:=30;
                                      2              :if (year mod 4=0)
                                                         and(year mod 100<>0)
                                                         or(year mod 400=0)
                                                         then zdt:=29
                                                         else zdt:=28
                                    end;{case}
                                    if zd>zdt
                                      then begin
                                             zd:=zd-zdt;
                                             zm:=month+1;
                                             if zd>29
                                               then begin
                                                      if zm=2
                                                        then begin
                                                               zm:=zm+1;
                                                               if (year mod 4=0)
                                                                  and(year mod 100<>0)
                                                                  or(year mod 400=0)
                                                                  then zd:=zd-29
                                                                  else zd:=zd-28
                                                             end
                                                    end
                                           end
                                  end
    end;{m}
  procedure w(h,d,e1,e2,f2,month,year;var zh,zd,zm,zy:integer);
    var
      e3,e4,zdt:integer;
    begin
      if f2='w'
        then begin
               if e1>e2
                 then begin
                        e3:=e1-e2;
                        zh:=h+e3;
                        if zh>24
                          then begin
                                 zh:=zh-24;
                                 zd:=d+1
                               end
                          else zd:=d
                         case month of
                                      1,3,5,7,8,10,12:zdt:=31;
                                      4,6,9,11       :zdt:=30;
                                      2              :if (year mod 4=0)
                                                         and(year mod 100<>0)
                                                         or(year mod 400=0)
                                                         then zdt:=29
                                                         else zdt:=28
                                    end;{case}
                                    if zd>zdt
                                      then begin
                                             zd:=zd-zdt;
                                             zm:=month+1;
                                             if zd>29
                                               then begin
                                                      if zm=2
                                                        then begin
                                                               zm:=zm+1;
                                                               if (year mod 4=0)
                                                                  and(year mod 100<>0)
                                                                  or(year mod 400=0)
                                                                  then zd:=zd-29
                                                                  else zd:=zd-28
                                                             end
                                                    end
                                           end
                      end
                 else if e1<e2
                        then begin
                               e3:=e2-e1;
                               zh:=h-e3;
                               if zh<0
                                 then begin
                                        zh:=zh+24;
                                        zd:=d-1
                                      end
                                 else zd:=d;
                               if zd<=0
                                 then begin
                                        zm:=month-1;
                                        if zm<=0
                                          then begin
                                                 zy:=year-1;
                                                 zm:=zm+12
                                               end
                                        case zm of
                                          1,3,5,7,8,10,12:zdt:=31;
                                          4,6,9,11       :zdt:=30;
                                          2              :if (year mod 4=0)
                                                             and(year mod 100<>0)
                                                             or(year mod 400=0)
                                                             then zdt:=29
                                                             else zdt:=28
                                        end{case}
                                      end
                             end
             end
        else if f2='b'
               then begin
                      e3:=e2-e1;
                      zh:=h-e3;
                      if zh<0
                        then begin
                               zh:=zh+24;
                               zd:=d-1
                             end
                        else zd:=d
                      if zd<=0
                                 then begin
                                        zm:=month-1;
                                        if zm<=0
                                          then begin
                                                 zy:=year-1;
                                                 zm:=zm+12
                                               end
                                        case zm of
                                          1,3,5,7,8,10,12:zdt:=31;
                                          4,6,9,11       :zdt:=30;
                                          2              :if (year mod 4=0)
                                                             and(year mod 100<>0)
                                                             or(year mod 400=0)
                                                             then zdt:=29
                                                             else zdt:=28
                                        end{case}
                                      end
                    end
               else if f2='e'
                       then begin
                              e3:=e2-e1;
                              zh:=h-e3;
                              if zh<0
                                 then begin
                                        zh:=zh+24;
                                        zd:=d-1
                                      end
                                 else zd:=d;
                              if zd<=0
                                 then begin
                                        zm:=month-1;
                                        if zm<=0
                                           then begin
                                                  zy:=year-1;
                                                  zm:=zm+12
                                                end
                                        case month of
                                          1,3,5,7,8,10,12:zdt:=31;
                                          4,6,9,11       :zdt:=30;
                                          2              :if (year mod 4=0)
                                                             and(year mod 100<>0)
                                                             or(year mod 400 =0)
                                                             then zdt:=29
                                                             else zdt:=28
                                        end{case}
                                      end
                            end
                       else if f2='m'
                               then begin
                                      case e1 of
                                        11:e4:=13;
                                        10:e4:=14;
                                        9 :e4:=15;
                                        8 :e4:=16;
                                        7 :e4:=17;
                                        6 :e4:=18;
                                        5 :e4:=19;
                                        4 :e4:=20;
                                        3 :e4:=21;
                                        2 :e4:=22;
                                        1 :e4:=23;
                                      end;{case}
                                      e3:=e4;
                                      zh:=h-e3;
                                      if zh<0
                                         then begin
                                                zh:=zh+24;
                                                zd:=d-1
                                              end
                                         else zd:=d;
                                      if zd<=0
                                         then begin
                                                zm:=month-1;
                                                if zm<=0
                                                   then begin
                                                          zy:=year-1;
                                                          zm:=zm+12
                                                        end
                                                case zm of
                                                  1,3,5,7,8,10,12:zdt:=31;
                                                  4,6,9,11       :zdt:=30;
                                                  2              :if (year mod 4=0)
                                                                     and(year mod 100<>0)
                                                                     or(year mod 400=0)
                                                                     then zdt:=29
                                                                     else zdt:=28
                                                end{case}
                                              end

                                    end
    end{w}
  procedure e(h,d,e1,e2,f2,month,year;var zh,zd,zm,zy:integer);
    var
      e3,e4,zdt:integer;
    begin
      if f2='e'
         then begin
                if e1>e2
                   then begin
                          e3:=e1-e2;
                          zh:=h-e3;
                          if zh<0
                             then begin
                                    zh:=zh+24;
                                    zd:=d-1;
                                  end
                             else zd:=d
                          if zd<=0
                             then begin
                                    zm:=month-1;
                                    if zm<=0
                                       then begin
                                              zy:=year-1;
                                              zm:=zm+12
                                            end
                                    case zm of
                                      1,3,5,7,8,10,12:zdt:=31;
                                      4,6,9,11       :zdt:=30;
                                      2              :if (year mod 4=0)
                                                         and(year mod 100<>0)
                                                         or(year mod 400=0)
                                                         then zdt:=29
                                                         else zdt:=28
                                    end{case}
                                  end
                        end
                   else if e1<e2
                           then begin
                                  e3:=e2-e1;
                                  zh:=h+e3;
                                  if zh>24
                                     then begin
                                            zh:=zh-24;
                                            zd:=d+1;
                                          end
                                     else zd:=d
                                end
                case month of
                                          1,3,5,7,8,10,12:zdt:=31;
                                          4,6,9,11       :zdt:=30;
                                          2              :if (year mod 4=0)
                                                             and(year mod 100<>0)
                                                             or(year mod 400 =0)
                                                             then zdt:=29
                                                             else zdt:=28
                                        end{case}
                if zd >zdt
                   then begin
                          zd:=zd-zdt;
                          zm:=month+1;
                          if zd>29
                             then begin
                                    if zm=2
                                       then begin
                                              zm:=zm+1
                                              if (year mod 4=0)
                                                 and(year mod 100<>0)
                                                 or(year mod 400=0)
                                                 then begin
                                                        zd:=zd-29
                                                      end
                                                 else zd:=zd-28
                                            end
                                  end
                        end
              end
         else if f2='b'
                 then begin
                        e3:=e2-e1;
                        zh:=h+e3;
                        if zh>24
                           then begin
                                  zh:=zh-24;
                                  zd:=d+1;
                                end
                           else zd:=d;
                        case month of
                                          1,3,5,7,8,10,12:zdt:=31;
                                          4,6,9,11       :zdt:=30;
                                          2              :if (year mod 4=0)
                                                             and(year mod 100<>0)
                                                             or(year mod 400 =0)
                                                             then zdt:=29
                                                             else zdt:=28
                                        end{case}
                        if zd >zdt
                   then begin
                          zd:=zd-zdt;
                          zm:=month+1;
                          if zd>29
                             then begin
                                    if zm=2
                                       then begin
                                              zm:=zm+1
                                              if (year mod 4=0)
                                                 and(year mod 100<>0)
                                                 or(year mod 400=0)
                                                 then begin
                                                        zd:=zd-29
                                                      end
                                                 else zd:=zd-28
                                            end
                                  end
                        end
                      end
                 else if f2='e'
                         then begin
                                 case e2 of
                                        11:e4:=13;
                                        10:e4:=14;
                                        9 :e4:=15;
                                        8 :e4:=16;
                                        7 :e4:=17;
                                        6 :e4:=18;
                                        5 :e4:=19;
                                        4 :e4:=20;
                                        3 :e4:=21;
                                        2 :e4:=22;
                                        1 :e4:=23;
                                      end;{case}
                                 e3:=e4-e1;
                                 zh:=2+e3;
                                 if zh>24
                                    then begin
                                           zh:=zh-24;
                                           zd:=d+1
                                         end
                                    else zd:=d;
                                 case month of
                                          1,3,5,7,8,10,12:zdt:=31;
                                          4,6,9,11       :zdt:=30;
                                          2              :if (year mod 4=0)
                                                             and(year mod 100<>0)
                                                             or(year mod 400 =0)
                                                             then zdt:=29
                                                             else zdt:=28
                                        end{case}
                                  if zd >zdt
                   then begin
                          zd:=zd-zdt;
                          zm:=month+1;
                          if zd>29
                             then begin
                                    if zm=2
                                       then begin
                                              zm:=zm+1
                                              if (year mod 4=0)
                                                 and(year mod 100<>0)
                                                 or(year mod 400=0)
                                                 then begin
                                                        zd:=zd-29
                                                      end
                                                 else zd:=zd-28
                                            end
                                  end
                        end
                              end
                         else if f2='m'
                                 then begin
                                        e3:=e1-e2;
                                        zh:=h-e3;
                                        if zh<0
                                           then begin
                                                  zh:=zh+24;
                                                  zd:=d-1
                                                end
                                           else zd:=d;
                                        if zd<=0
                             then begin
                                    zm:=month-1;
                                    if zm<=0
                                       then begin
                                              zy:=year-1;
                                              zm:=zm+12
                                            end
                                    case zm of
                                      1,3,5,7,8,10,12:zdt:=31;
                                      4,6,9,11       :zdt:=30;
                                      2              :if (year mod 4=0)
                                                         and(year mod 100<>0)
                                                         or(year mod 400=0)
                                                         then zdt:=29
                                                         else zdt:=28
                                    end{case}
                                  end
                                      end
    end;{e}
  procedure b(h,d,e1,e2,f2,month,year;var zh,zd,zm,zy:integer);
    var
      e3,zdt:integer;
    begin
      if f2='b'
         then zh:=h
         else if f2='w'
                 then begin
                        e3:=e1-e2;
                        zh:=h+e3;
                        if zh>24
                           then begin
                                  zh:=zh-24;
                                  zd:=d+1
                                end
                           else zd:=d
                         case month of
                                          1,3,5,7,8,10,12:zdt:=31;
                                          4,6,9,11       :zdt:=30;
                                          2              :if (year mod 4=0)
                                                             and(year mod 100<>0)
                                                             or(year mod 400 =0)
                                                             then zdt:=29
                                                             else zdt:=28
                                        end{case}
                                  if zd >zdt
                   then begin
                          zd:=zd-zdt;
                          zm:=month+1;
                          if zd>29
                             then begin
                                    if zm=2
                                       then begin
                                              zm:=zm+1
                                              if (year mod 4=0)
                                                 and(year mod 100<>0)
                                                 or(year mod 400=0)
                                                 then begin
                                                        zd:=zd-29
                                                      end
                                                 else zd:=zd-28
                                            end
                                  end
                        end
                      end
                 else if f2='m'
                         then begin
                                zh:=h-12
                                if zh<0
                                   then begin
                                          zh:=zh+24;
                                          zd:=d-1
                                        end
                                   else zd:=d
                                 if zd<=0
                             then begin
                                    zm:=month-1;
                                    if zm<=0
                                       then begin
                                              zy:=year-1;
                                              zm:=zm+12
                                            end
                                    case zm of
                                      1,3,5,7,8,10,12:zdt:=31;
                                      4,6,9,11       :zdt:=30;
                                      2              :if (year mod 4=0)
                                                         and(year mod 100<>0)
                                                         or(year mod 400=0)
                                                         then zdt:=29
                                                         else zdt:=28
                                    end{case}
                                  end
                              end
                         else if f2='e';
                                 then begin
                                        e3:=e1-e2;
                                        zh:=h-e3;
                                        if zh<0
                                           then begin
                                                  zh:=zh+24;
                                                  zd:=d-1
                                                end
                                           else zd:=d
                                        if zd<=0
                             then begin
                                    zm:=month-1;
                                    if zm<=0
                                       then begin
                                              zy:=year-1;
                                              zm:=zm+12
                                            end
                                    case zm of
                                      1,3,5,7,8,10,12:zdt:=31;
                                      4,6,9,11       :zdt:=30;
                                      2              :if (year mod 4=0)
                                                         and(year mod 100<>0)
                                                         or(year mod 400=0)
                                                         then zdt:=29
                                                         else zdt:=28
                                    end{case}
                                  end
                                      end
    end;{b}
  begin
    writeln('please input h d e1 e2 f2 month year');
    read(h,d,e1,e2,f2,month,year);
    if f1='m'
       then m(h,d,e1,e2,f2,month,year)
       else if f1='w'
               then w(h,d,e1,e2,f2,month,year)
               else if f1='e'
                       then e(h,d,e1,e2,f2,month,year)
                       else if f1='b'
                               then b(h,d,e1,e2,f2,month,year)
                               else writeln('no this char in system');
    writeln(zm,'/',zd,'/',zy,'','',zh,':',m,':',s)
  end.
搜索更多相关主题的帖子: 源代码 价值 
2009-07-30 21:21
黑帽白客
Rank: 2
等 级:论坛游民
帖 子:7
专家分:20
注 册:2009-7-30
得分:0 
给大家看一个有价值的源代码
我一个朋友说编程论坛里高手云集,就过来看看,想不到所谓的高手不过是一群乌合之众,连我随便写的程序都没人看的懂,切!菜鸟一帮。。。
2009-08-02 13:52
黑帽白客
Rank: 2
等 级:论坛游民
帖 子:7
专家分:20
注 册:2009-7-30
得分:0 
广州鸟
你个广州鸟算什么,我郑重地告诉你,人说的语言你都不配说,给我滚,不滚轰杀你!
2009-08-02 21:27



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




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

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