zoukankan      html  css  js  c++  java
  • 输出日历

                                                                输出日历

      Calendar 2006-12
    --------------------------
    Su  Mo  Tu  We  Th  Fr  Sa
    --------------------------
                         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
    --------------------------

     code:

      import java.util.*;
    public class Main {
        public static void fun()
        {
            System.out.print("Calendar 2006-12"+" ");
            System.out.print("--------------------------"+" ");
            System.out.print("Su  Mo  Tu  We  Th  Fr  Sa"+" ");
            System.out.print("--------------------------"+" ");
            int temp = 0;
            for(int i=1;i<=31;i++)
            {
                 if(i<2)
                 {
                    System.out.print("                     ");
                    System.out.print(i+"   "+(i+1)+" ");
                 }
                 if(i>2&&i<10)
                 {
                     System.out.print(" "+i+"  ");
                     if(i==9)
                     {
                         System.out.print(" ");
                     }
                 }
                  
                  if(i>=10&&i<17)
                  {
                      System.out.print(i+"  ");
                      if(i==16)
                      {
                          System.out.print(" ");
                      }
                  }
                  
                  if(i>=17&&i<24)
                  {
                      System.out.print(i+"  ");
                      if(i==23)
                      {
                          System.out.print(" ");
                      }
                  }
                  
                  if(i>=24&&i<31)
                  {
                      System.out.print(i+"  ");
                      if(i==30)
                      {
                          System.out.print(" ");
                      }
                  }
                  
                   if(i==31)
                   {
                       System.out.print(i);
                   }
                  
                    
            }
            System.out.print(" "+"--------------------------"+" ");
            
            
            
        }
      public static void main(String[] args)
      {
        fun();  
      }
     
    }

  • 相关阅读:
    一个日志框架的开源,有些不错的创意。
    发现vs2005一个bug!庆祝一下!
    (新手文)偶说说什么是IoC (反向注入、依赖注入)
    数据库移植到sql server遇到的问题。
    Pixysoft.Framework.Configuration 开发实录
    Pixysoft.Framework.Noebe.Json 开发实录
    介绍一下我设计的工作流引擎,欢迎拍砖仍鸡蛋
    用mysql相当多问题。不是说开源不好,可是拜托,争争气吧
    设计之路——我的成果小报告
    黑客攻击:20090921 23:41:17:171
  • 原文地址:https://www.cnblogs.com/pwhit/p/5263931.html
Copyright © 2011-2022 走看看