| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3504 人关注过本帖
标题:给大家看一个有价值的源代码
只看楼主 加入收藏
黑帽白客
Rank: 2
等 级:论坛游民
帖 子:7
专家分:20
注 册:2009-7-30
结帖率:100%
收藏
 问题点数:0 回复次数:13 
给大家看一个有价值的源代码
最近无聊啊,就到书店逛了逛,看了一下,买了一本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: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-8-2
收藏
得分:0 
垃圾也敢拿来这里发.不知天高地厚的东西
2009-08-02 20:46
黑帽白客
Rank: 2
等 级:论坛游民
帖 子:7
专家分:20
注 册:2009-7-30
收藏
得分:0 
广州鸟
你个广州鸟算什么,我郑重地告诉你,人说的语言你都不配说,给我滚,不滚轰杀你!
2009-08-02 21:27
longloo
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-12-12
收藏
得分:0 
汗 什么样的人都有这年头
2009-08-05 12:35
longloo
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-12-12
收藏
得分:0 
只能说句 先学做人 在学技术
2009-08-05 12:37
autosun
Rank: 1
来 自:辽宁沈阳
等 级:新手上路
帖 子:107
专家分:0
注 册:2007-1-21
收藏
得分:0 
好久不来了,怎么刚上来就看到这么一帖,请求BJ删掉!

2009-08-10 21:20
lmgdmc
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-24
收藏
得分:0 
靠,连通用习惯都不懂,还拿出来。
2009-08-21 11:44
jack_lvzheng
Rank: 1
等 级:新手上路
威 望:1
帖 子:55
专家分:3
注 册:2007-9-22
收藏
得分:0 
我也汗死了,不过也有一个长篇大论,free Pascal 的程序
qq:1020854463
嘻嘻。。
程序:
uses crt,dos,graph;
const
  v1:array [1..6] of byte = (4,9,19,24,34,39);
  v2:packed array [0..9,1..5,1..4] of 0..15 =
   (((1,1,1,1),(1,0,0,1),(1,0,0,1),(1,0,0,1),(1,1,1,1)),
    ((0,0,0,1),(0,0,0,1),(0,0,0,1),(0,0,0,1),(0,0,0,1)),
    ((1,1,1,1),(0,0,0,1),(1,1,1,1),(1,0,0,0),(1,1,1,1)),
    ((1,1,1,1),(0,0,0,1),(1,1,1,1),(0,0,0,1),(1,1,1,1)),
    ((1,0,0,1),(1,0,0,1),(1,1,1,1),(0,0,0,1),(0,0,0,1)),
    ((1,1,1,1),(1,0,0,0),(1,1,1,1),(0,0,0,1),(1,1,1,1)),
    ((1,1,1,1),(1,0,0,0),(1,1,1,1),(1,0,0,1),(1,1,1,1)),
    ((1,1,1,1),(0,0,0,1),(0,0,0,1),(0,0,0,1),(0,0,0,1)),
    ((1,1,1,1),(1,0,0,1),(1,1,1,1),(1,0,0,1),(1,1,1,1)),
    ((1,1,1,1),(1,0,0,1),(1,1,1,1),(0,0,0,1),(1,1,1,1)));
var
  i,j,k,h,m,s,h1,m1,s1,hun,a:word;
  dr,mo:integer;
procedure putp(x,y,col:integer);  var i,j,k:integer;  begin    k:=10;    for i:=0 to k-1 do      for j:=0 to k-1 do        putpixel(x*k+i,y*k+j,col);  end;
procedure num(p,q:integer);
  begin
    for j:=1 to 4 do
      for k:=1 to 5 do
        putp(v1[p]+j-1,4+k-1,v2[q div 10,k,j]);
    for j:=1 to 4 do
      for k:=1 to 5 do
        putp(v1[p+1]+j-1,4+k-1,v2[q mod 10,k,j]);

  end;

begin
  dr:=detect; initgraph(dr,mo,''); setgraphmode(2);
  for i:=2 to 44 do begin putp(i,2,1); putp(i,10,1); end;
  for i:=2 to 10 do begin putp(2,i,1); putp(44,i,1); end;
  putp(15,4,1); putp(16,4,1); putp(15,5,1); putp(16,5,1);
  putp(15,7,1); putp(16,7,1); putp(15,8,1); putp(16,8,1);
  putp(30,4,1); putp(31,4,1); putp(30,5,1); putp(31,5,1);
  putp(30,7,1); putp(31,7,1); putp(30,8,1); putp(31,8,1);
  h1:=24; m1:=60; s1:=60;
  a:=60;
  while true do
    begin
      if a=60 then begin gettime(h,m,s,hun); a:=0; end else s:=s+1;
      if s=60 then begin m:=m+1; s:=0; end;
      if m=60 then begin h:=h+1; m:=0; end;
      if h=24 then h:=0;
      if h<>h1 then num(1,h);
      if m<>m1 then num(3,m);
      if s<>s1 then num(5,s);
      h1:=h; m1:=m; s1:=s; a:=a+1;
      delay(970);
    end;
  readln;
  restorecrtmode;
end.

JACK
2009-08-24 12:43
沉沦过迁
Rank: 2
来 自:广西百色
等 级:论坛游民
帖 子:2297
专家分:10
注 册:2007-5-8
收藏
得分:0 
林子大了 什么鸟都有呀
楼猪是病猪

也许我没有明天,但是我拥有现在
2010-03-12 11:39
快速回复:给大家看一个有价值的源代码
数据加载中...
 
   



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

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