From 644f678387cd81a87bd0c73ea0123c825bc99e59 Mon Sep 17 00:00:00 2001
From: We-unite <3205135446@qq.com>
Date: Thu, 4 Jan 2024 17:14:26 +0800
Subject: Format all the codes using clang-format

Renew some test params.
---
 .gitignore         |   6 +-
 src/.clang-format  | 121 ++++++++++++++++++++++++++
 src/Julian.cpp     | 116 ++++++++++++-------------
 src/List.cpp       | 239 +++++++++++++++++++-------------------------------
 src/calendar.cpp   | 250 ++++++++++++++++++++++++-----------------------------
 src/calendar.h     | 162 +++++++++++++++++-----------------
 src/parameters.cpp | 247 +++++++++++++++++++++++++---------------------------
 test.sh            |  14 +--
 8 files changed, 581 insertions(+), 574 deletions(-)
 create mode 100644 src/.clang-format

diff --git a/.gitignore b/.gitignore
index 597f7ce..a029ac1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,4 @@
-#Ignore all
 *
-#Unignore all with extensions
 !*.*
 # Unignore all makefiles named Makefile or makefile
 !Makefile
@@ -10,10 +8,8 @@
 #Ignore swp
 *.swp
 #Ignore res
-res.txt
-err.txt
+*.txt
 push.sh
-test*
 !test.sh
 *.o
 #Ignore dir data/vsop87 
diff --git a/src/.clang-format b/src/.clang-format
new file mode 100644
index 0000000..a1054a5
--- /dev/null
+++ b/src/.clang-format
@@ -0,0 +1,121 @@
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:   
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: false
+  AfterStruct:     false
+  AfterUnion:      false
+  AfterExternBlock: false
+  BeforeCatch:     false
+  BeforeElse:      false
+  IndentBraces:    false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:   
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
+IncludeBlocks:   Preserve
+IncludeCategories: 
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+    Priority:        2
+  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+    Priority:        3
+  - Regex:           '.*'
+    Priority:        1
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+IndentPPDirectives: None
+IndentWidth:     4
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+ReflowComments:  true
+SortIncludes:    true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Cpp11
+StatementMacros: 
+  - Q_UNUSED
+  - QT_REQUIRE_VERSION
+TabWidth:        8
+UseTab:          Never
+...
+
diff --git a/src/Julian.cpp b/src/Julian.cpp
index 907c94e..5a0522b 100644
--- a/src/Julian.cpp
+++ b/src/Julian.cpp
@@ -9,93 +9,83 @@
  * 但是我目前提供的中time_t类型为64位整数,因而可以表示数千年的时间范围
  */
 
-double Julian::d[23][5]={
-    {-4000,  108371.700000,  -13036.800000,  392.000000,   0.000000},
-    { -500,   17201.000000,    -627.820000,   16.170000,  -0.341300},
-    { -150,   12200.600000,    -346.410000,    5.403000,  -0.159300},
-    {  150,    9113.800000,    -328.130000,   -1.647000,   0.037700},
-    {  500,    5707.500000,    -391.410000,    0.915000,   0.314500},
-    {  900,    2203.400000,    -283.450000,   13.034000,  -0.177800},
-    { 1300,     490.100000,     -57.350000,    2.085000,  -0.007200},
-    { 1600,     120.000000,      -9.810000,   -1.532000,   0.140300},
-    { 1700,      10.200000,      -0.910000,    0.510000,  -0.037000},
-    { 1800,      13.400000,      -0.720000,    0.202000,  -0.019300},
-    { 1830,       7.800000,      -1.810000,    0.416000,  -0.024700},
-    { 1860,       8.300000,      -0.130000,   -0.406000,   0.029200},
-    { 1880,      -5.400000,       0.320000,   -0.183000,   0.017300},
-    { 1900,      -2.300000,       2.060000,    0.169000,  -0.013500},
-    { 1920,      21.200000,       1.690000,   -0.304000,   0.016700},
-    { 1940,      24.200000,       1.220000,   -0.064000,   0.003100},
-    { 1960,      33.200000,       0.510000,    0.231000,  -0.010900},
-    { 1980,      51.000000,       1.290000,   -0.026000,   0.003200},
-    { 2000,      63.870000,       0.100000,    0.000000,   0.000000},
-    { 2005,      64.700000,       0.210000,    0.000000,   0.000000},
-    { 2012,      66.800000,       0.220000,    0.000000,   0.000000},
-    { 2018,      69.000000,       0.360000,    0.000000,   0.000000},
-    { 2028,      72.600000,       0.000000,    0.000000,   0.000000}
-};
+double Julian::d[23][5] = {
+    {-4000, 108371.700000, -13036.800000, 392.000000, 0.000000},
+    {-500, 17201.000000, -627.820000, 16.170000, -0.341300},
+    {-150, 12200.600000, -346.410000, 5.403000, -0.159300},
+    {150, 9113.800000, -328.130000, -1.647000, 0.037700},
+    {500, 5707.500000, -391.410000, 0.915000, 0.314500},
+    {900, 2203.400000, -283.450000, 13.034000, -0.177800},
+    {1300, 490.100000, -57.350000, 2.085000, -0.007200},
+    {1600, 120.000000, -9.810000, -1.532000, 0.140300},
+    {1700, 10.200000, -0.910000, 0.510000, -0.037000},
+    {1800, 13.400000, -0.720000, 0.202000, -0.019300},
+    {1830, 7.800000, -1.810000, 0.416000, -0.024700},
+    {1860, 8.300000, -0.130000, -0.406000, 0.029200},
+    {1880, -5.400000, 0.320000, -0.183000, 0.017300},
+    {1900, -2.300000, 2.060000, 0.169000, -0.013500},
+    {1920, 21.200000, 1.690000, -0.304000, 0.016700},
+    {1940, 24.200000, 1.220000, -0.064000, 0.003100},
+    {1960, 33.200000, 0.510000, 0.231000, -0.010900},
+    {1980, 51.000000, 1.290000, -0.026000, 0.003200},
+    {2000, 63.870000, 0.100000, 0.000000, 0.000000},
+    {2005, 64.700000, 0.210000, 0.000000, 0.000000},
+    {2012, 66.800000, 0.220000, 0.000000, 0.000000},
+    {2018, 69.000000, 0.360000, 0.000000, 0.000000},
+    {2028, 72.600000, 0.000000, 0.000000, 0.000000}};
 
-double Julian::dt_ext(int y,double jsd)
-{
-    double dy=(double)(y-1820)/100.0;
-    return -20+jsd*dy*dy;
+double Julian::dt_ext(int y, double jsd) {
+    double dy = (double)(y - 1820) / 100.0;
+    return -20 + jsd * dy * dy;
 }
 
 //计算力学时与世界时之差,传入年份
-double Julian::delta_t(int y)
-{
-    int y0=d[22][0];//表中最后一行的年份
-    double t0=d[22][1];//表中最后一行的delta_t
+double Julian::delta_t(int y) {
+    int y0 = d[22][0];    //表中最后一行的年份
+    double t0 = d[22][1]; //表中最后一行的delta_t
     double jsd;
 
-    if(y>y0)
-    {
-        jsd=31;
-        if(y-y0>100)
-        {
-            return dt_ext(y,jsd);
+    if (y > y0) {
+        jsd = 31;
+        if (y - y0 > 100) {
+            return dt_ext(y, jsd);
         }
 
-        double v=dt_ext(y,jsd);
-        double dv=dt_ext(y0,jsd)-t0;
-        return v-dv*(y0+100-y)/100;
+        double v = dt_ext(y, jsd);
+        double dv = dt_ext(y0, jsd) - t0;
+        return v - dv * (y0 + 100 - y) / 100;
     }
 
     double res;
-    for(int i=0;i<22;i++)
-    {
-        if(y<d[i+1][0])
-        {
+    for (int i = 0; i < 22; i++) {
+        if (y < d[i + 1][0]) {
             break;
         }
-        double t1=(y-d[i][0])/(d[i+1][0]-d[i][0])*10;
-        double t2=t1*t1;
-        double t3=t2*t1;
-        res=d[i][1]+d[i][2]*t1+d[i][3]*t2+d[i][4]*t3;
+        double t1 = (y - d[i][0]) / (d[i + 1][0] - d[i][0]) * 10;
+        double t2 = t1 * t1;
+        double t3 = t2 * t1;
+        res = d[i][1] + d[i][2] * t1 + d[i][3] * t2 + d[i][4] * t3;
     }
     return res;
 }
 
 // 计算儒略日
-double Julian::getJulianDay(time_t time)
-{
-    double t=(double)time;
-    //2440587.5为1970年1月1日0时的儒略日数
-    return (double)t/86400.0+2440587.5;
+double Julian::getJulianDay(time_t time) {
+    double t = (double)time;
+    // 2440587.5为1970年1月1日0时的儒略日数
+    return (double)t / 86400.0 + 2440587.5;
 }
 
 // 计算儒略千年数,自JD2000(即2000年1月1日12时)起算
-double Julian::getJulianKiloYear(time_t time)
-{
+double Julian::getJulianKiloYear(time_t time) {
     double jd = getJulianDay(time);
-    //2451545.0为2000年1月1日12时的儒略日数,365250.0为一千年的天数
-    return (double)(jd-2451545.0)/365250.0;
+    // 2451545.0为2000年1月1日12时的儒略日数,365250.0为一千年的天数
+    return (double)(jd - 2451545.0) / 365250.0;
 }
 
 //儒略千年数转时间戳
-time_t Julian::kiloYearToTime(double t,int year)
-{
-    double jd=t*365250.0+2451545.0;
-    time_t time=(time_t)((jd-2440587.5)*86400.0-delta_t(year));
+time_t Julian::kiloYearToTime(double t, int year) {
+    double jd = t * 365250.0 + 2451545.0;
+    time_t time = (time_t)((jd - 2440587.5) * 86400.0 - delta_t(year));
     return time;
 }
diff --git a/src/List.cpp b/src/List.cpp
index 99aa1a6..b4600bc 100644
--- a/src/List.cpp
+++ b/src/List.cpp
@@ -1,37 +1,32 @@
 #include "calendar.h"
 
-List::List()
-{
+List::List() {
     // 为方便初始化,链表头结点设为空节点,注意不要使用
-    head=new point(0,0,0,0,0,0,false,false,false,-1,-1,false,0);
-    tail=head;
+    head = new point(0, 0, 0, 0, 0, 0, false, false, false, -1, -1, false, 0);
+    tail = head;
 }
 
-List::~List()
-{
-    point* p=head;
-    while(p!=NULL)
-    {
-        point* q=p->next;
+List::~List() {
+    point *p = head;
+    while (p != NULL) {
+        point *q = p->next;
         delete p;
-        p=q;
+        p = q;
     }
-
 }
 
 // 链表尾部插入
-void List::append(Date* date,bool isShuo,bool isJieqi,bool isZhongqi,int JieqiIndex,double time)
-{
-    point* p=new point(date->tm_year+1900,date->tm_mon+1,date->tm_mday,date->tm_hour,date->tm_min,date->tm_sec,isShuo,isJieqi,isZhongqi,JieqiIndex,0,false,time);
-    tail->next=p;
-    tail=p;
+void List::append(Date *date, bool isShuo, bool isJieqi, bool isZhongqi,
+                  int JieqiIndex, double time) {
+    point *p = new point(date->tm_year + 1900, date->tm_mon + 1, date->tm_mday,
+                         date->tm_hour, date->tm_min, date->tm_sec, isShuo,
+                         isJieqi, isZhongqi, JieqiIndex, 0, false, time);
+    tail->next = p;
+    tail = p;
 
-    if(isShuo)
-    {
+    if (isShuo) {
         shuori_vec.push_back(p);
-    }
-    else if(isJieqi&&isZhongqi)
-    {
+    } else if (isJieqi && isZhongqi) {
         zhongqi_vec.push_back(p);
     }
 }
@@ -43,194 +38,142 @@ void List::append(Date* date,bool isShuo,bool isJieqi,bool isZhongqi,int JieqiIn
  * 这是今历沿用的顺治时宪历之规定,
  * 即朔日只要和中气同日,不论先后,该中气即算作下一月
  */
-void List::lunar_sort()
-{
-    point* cur,*pre;
+void List::lunar_sort() {
+    point *cur, *pre;
     bool flag;
-    do
-    {
-        flag=false;
-        pre=head;
-        do
-        {
-            cur=pre->next;
-            if(later(cur,cur->next))
-            {
-                flag=true;
-                pre->next=cur->next;
-                cur->next=cur->next->next;
-                pre->next->next=cur;
+    do {
+        flag = false;
+        pre = head;
+        do {
+            cur = pre->next;
+            if (later(cur, cur->next)) {
+                flag = true;
+                pre->next = cur->next;
+                cur->next = cur->next->next;
+                pre->next->next = cur;
             }
-            pre=pre->next;
-        }while(pre->next!=tail);
-    }while(flag);
+            pre = pre->next;
+        } while (pre->next != tail);
+    } while (flag);
 
-    for(pre=head;pre->next!=tail;pre=pre->next)
-    {
-        cur=pre->next;
-        if(cur->isZhongqi&&cur->next->isShuo&&cur->next->year==cur->year&&cur->next->mon==cur->mon&&cur->next->day==cur->day)
-        {
-            pre->next=cur->next;
-            cur->next=cur->next->next;
-            pre->next->next=cur;
+    for (pre = head; pre->next != tail; pre = pre->next) {
+        cur = pre->next;
+        if (cur->isZhongqi && cur->next->isShuo &&
+            cur->next->year == cur->year && cur->next->mon == cur->mon &&
+            cur->next->day == cur->day) {
+            pre->next = cur->next;
+            cur->next = cur->next->next;
+            pre->next->next = cur;
         }
     }
 }
 
-
-bool List::later(point* a,point* b)
-{
+bool List::later(point *a, point *b) {
     // 比较a是否比b晚
     // 比较年
-    if(a->year>b->year)
-    {
+    if (a->year > b->year) {
         return true;
-    }
-    else if(a->year<b->year)
-    {
+    } else if (a->year < b->year) {
         return false;
     }
     // 比较月
-    else if(a->mon>b->mon)
-    {
+    else if (a->mon > b->mon) {
         return true;
-    }
-    else if(a->mon<b->mon)
-    {
+    } else if (a->mon < b->mon) {
         return false;
     }
     // 比较日
-    else if(a->day>b->day)
-    {
+    else if (a->day > b->day) {
         return true;
-    }
-    else if(a->day<b->day)
-    {
+    } else if (a->day < b->day) {
         return false;
     }
     // 比较时
-    else if(a->hour>b->hour)
-    {
+    else if (a->hour > b->hour) {
         return true;
-    }
-    else if(a->hour<b->hour)
-    {
+    } else if (a->hour < b->hour) {
         return false;
     }
     // 比较分
-    else if(a->min>b->min)
-    {
+    else if (a->min > b->min) {
         return true;
-    }
-    else if(a->min<b->min)
-    {
+    } else if (a->min < b->min) {
         return false;
     }
     // 比较秒
-    else if(a->sec>b->sec)
-    {
+    else if (a->sec > b->sec) {
         return true;
-    }
-    else if(a->sec<b->sec)
-    {
+    } else if (a->sec < b->sec) {
         return false;
-    }
-    else
-    {
+    } else {
         return false;
     }
 }
 
 //置闰月
-void List::Run()
-{
-    point* cur;
-    int i=0,j=0;
-    int mon_index=11;
+void List::Run() {
+    point *cur;
+    int i = 0, j = 0;
+    int mon_index = 11;
     bool flag;
-    while(later(zhongqi_vec[12],shuori_vec[i]))
-    {
+    while (later(zhongqi_vec[12], shuori_vec[i])) {
         i++;
     }
 
-    if(i==13)
-    {
+    if (i == 13) {
         //冬至之间有13个朔日,置闰
-        for(j=0;j<shuori_vec.size()-1;j++)
-        {
-            flag=true;
-            cur=shuori_vec[j]->next;
-            while(cur!=shuori_vec[j+1])
-            {
-                if(cur->isZhongqi)
-                {
+        for (j = 0; j < shuori_vec.size() - 1; j++) {
+            flag = true;
+            cur = shuori_vec[j]->next;
+            while (cur != shuori_vec[j + 1]) {
+                if (cur->isZhongqi) {
                     //本月有中气,不置闰
-                    flag=false;
+                    flag = false;
                 }
-                cur=cur->next;
+                cur = cur->next;
             }
-            if(flag)
-            {
-                shuori_vec[j]->MonthIndex=mon_index;
-                shuori_vec[j]->RunYue=true;
+            if (flag) {
+                shuori_vec[j]->MonthIndex = mon_index;
+                shuori_vec[j]->RunYue = true;
                 j++;
                 break;
-            }
-            else
-            {
+            } else {
                 mon_index++;
-                if(mon_index==13)
-                {
-                    mon_index=1;
+                if (mon_index == 13) {
+                    mon_index = 1;
                 }
-                shuori_vec[j]->MonthIndex=mon_index;
-                shuori_vec[j]->RunYue=false;
+                shuori_vec[j]->MonthIndex = mon_index;
+                shuori_vec[j]->RunYue = false;
             }
         }
-
     }
     //冬至之间有12个朔日,不置闰
     //同时处理置闰完毕之后的朔日
-    for(;j<shuori_vec.size()-1;j++)
-    {
+    for (; j < shuori_vec.size() - 1; j++) {
         mon_index++;
-        if(mon_index==13)
-        {
-            mon_index=1;
+        if (mon_index == 13) {
+            mon_index = 1;
         }
-        shuori_vec[j]->MonthIndex=mon_index;
-        shuori_vec[j]->RunYue=false;
+        shuori_vec[j]->MonthIndex = mon_index;
+        shuori_vec[j]->RunYue = false;
     }
 }
 
 //输出链表内容
-void List::output()
-{
-    for(point* i=head->next;i!=NULL;i=i->next)
-    {
-        printf("%d-%02d-%02d %02d:%02d:%02d  ",i->year,i->mon,i->day,i->hour,i->min,i->sec);
-        if(i->isJieqi)
-        {
-            printf("%s",jieqi[i->JieqiIndex]);
-            if(i->isZhongqi)
-            {
-                printf("  中气");
-            }
-            printf("\n");
-        }
-        else if(i->isShuo)
-        {
+void List::output() {
+    for (point *i = head->next; i != NULL; i = i->next) {
+        printf("%d-%02d-%02d %02d:%02d:%02d  ", i->year, i->mon, i->day,
+               i->hour, i->min, i->sec);
+        if (i->isJieqi) {
+            printf("%s\n", jieqi[i->JieqiIndex]);
+        } else if (i->isShuo) {
             printf("朔日");
-            if(i->RunYue)
-            {
-                printf("  闰%d月",i->MonthIndex);
-            }
-            else
-            {
-                printf("  %d月",i->MonthIndex);
+            if (i->RunYue) {
+                printf("  闰%d月", i->MonthIndex);
+            } else {
+                printf("  %d月", i->MonthIndex);
             }
             printf("\n");
         }
     }
-
 }
diff --git a/src/calendar.cpp b/src/calendar.cpp
index 492cdbc..dcb96d7 100644
--- a/src/calendar.cpp
+++ b/src/calendar.cpp
@@ -4,136 +4,123 @@
 #include <ctime>
 
 /*以下为"calendar.h规定之量*/
-double pi=3.14159265358979323846;
-double day=86400;
-double delta=1e-11;
-char jieqi[25][10]={"冬至","小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"};
+double pi = 3.14159265358979323846;
+double day = 86400;
+double delta = 1e-11;
+char jieqi[25][10] = {"冬至", "小寒", "大寒", "立春", "雨水", "惊蛰", "春分",
+                      "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑",
+                      "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降",
+                      "立冬", "小雪", "大雪", "冬至"};
 
 /*计算需要用的类的实例化*/
 Julian julian;
 parameter p;
 List list;
 
-
-Date* input(char* argv)
-{
-    Date* date=new Date;
+Date *input(char *argv) {
+    Date *date = new Date;
 
     // 输入年份,自当年元旦起算
-    date->tm_year=atoi(argv)-1900;
-    date->tm_mon=0;
-    date->tm_mday=1;
-    date->tm_hour=0;
-    date->tm_min=0;
-    date->tm_sec=0;
+    date->tm_year = atoi(argv) - 1900;
+    date->tm_mon = 0;
+    date->tm_mday = 1;
+    date->tm_hour = 0;
+    date->tm_min = 0;
+    date->tm_sec = 0;
 
     return date;
 }
 
 /*计算当年二十四节气时刻,自去年冬至到本年冬至*/
-void JieQi(Date* date)
-{
+void JieQi(Date *date) {
     //计算起始时间为去年12月19日0时,开始寻找去年冬至
-    time_t time=mktime(date);
-    time-=13*day;
+    time_t time = mktime(date);
+    time -= 13 * day;
 
-    double t,t_end,t_middle;//采用二分法计算,t与t_end为间隔24h的两个时刻
-    double target_angle;//目标角度
-    Date* date_tmp;
+    double t, t_end, t_middle; //采用二分法计算,t与t_end为间隔24h的两个时刻
+    double target_angle; //目标角度
+    Date *date_tmp;
 
     //计算每个节气对应太阳地心黄经
-    for(int i=0;i<25;i++,time+=12*day)
-    {
-        target_angle=15*i+270;
-        if(target_angle>=360)
-            target_angle-=360;
+    for (int i = 0; i < 25; i++, time += 12 * day) {
+        target_angle = 15 * i + 270;
+        if (target_angle >= 360)
+            target_angle -= 360;
 
-        t=julian.getJulianKiloYear(time);
-        t_end=julian.getJulianKiloYear(time+day);
+        t = julian.getJulianKiloYear(time);
+        t_end = julian.getJulianKiloYear(time + day);
 
         //定春分
-        if(target_angle==0)
-        {
+        if (target_angle == 0) {
             /* 春分太阳地心视黄经为0,一般二分法不便于计算
              * 因而限定范围为[355,360)∪(0,5],即春分前后各5度
              * 当t_end时刻太阳地心视黄经在[355,360)时,证明春分在后边,t和t_end前进24h
              */
-            while(p.sun_longitude(t_end)<360&&p.sun_longitude(t_end)>355)
-            {
-                time+=day;
-                t=t_end;
-                t_end=julian.getJulianKiloYear(time+day);
+            while (p.sun_longitude(t_end) < 360 &&
+                   p.sun_longitude(t_end) > 355) {
+                time += day;
+                t = t_end;
+                t_end = julian.getJulianKiloYear(time + day);
             }
             /* 循环体time每次在已经计算出的上一节气基础上前进12日,理论上春分在t_end之后
              * 当跳出上一while循环时理论上春分时刻正在t与t_end之间
              * 为保险起见,添加这个循环
              * 当t时刻太阳地心视黄经在[0,5]时,证明春分在前边,t和t_end后退24h
              */
-            while(p.sun_longitude(t)<5)
-            {
-                time-=day;
-                t_end=t;
-                t=julian.getJulianKiloYear(time);
+            while (p.sun_longitude(t) < 5) {
+                time -= day;
+                t_end = t;
+                t = julian.getJulianKiloYear(time);
             }
 
             //二分法计算春分
-            while(t_end-t>delta)
-            {
-                t_middle=(t+t_end)/2;
-                if(p.sun_longitude(t_middle)<360&&p.sun_longitude(t_middle)>355)
-                {
-                    t=t_middle;
-                }
-                else
-                {
-                    t_end=t_middle;
+            while (t_end - t > delta) {
+                t_middle = (t + t_end) / 2;
+                if (p.sun_longitude(t_middle) < 360 &&
+                    p.sun_longitude(t_middle) > 355) {
+                    t = t_middle;
+                } else {
+                    t_end = t_middle;
                 }
             }
         }
         //其他情况
-        else
-        {
+        else {
             //当t_end时刻太阳地心视黄经小于目标角度,节气在后,t和t_end前进24h
-            while(p.sun_longitude(t_end)<target_angle)
-            {
-                time+=day;
-                t=t_end;
-                t_end=julian.getJulianKiloYear(time+day);
+            while (p.sun_longitude(t_end) < target_angle) {
+                time += day;
+                t = t_end;
+                t_end = julian.getJulianKiloYear(time + day);
             }
 
             //当t时刻太阳地心视黄经大于目标角度,节气在前,t和t_end后退24h
             //该循环也是一个保险循环
-            while(p.sun_longitude(t)>target_angle)
-            {
-                time-=day;
-                t_end=t;
-                t=julian.getJulianKiloYear(time);
+            while (p.sun_longitude(t) > target_angle) {
+                time -= day;
+                t_end = t;
+                t = julian.getJulianKiloYear(time);
             }
 
-            while(t_end-t>delta)
-            {
-                t_middle=(t+t_end)/2;
-                if(p.sun_longitude(t_middle)<target_angle)
-                {
-                    t=t_middle;
-                }
-                else
-                {
-                    t_end=t_middle;
+            while (t_end - t > delta) {
+                t_middle = (t + t_end) / 2;
+                if (p.sun_longitude(t_middle) < target_angle) {
+                    t = t_middle;
+                } else {
+                    t_end = t_middle;
                 }
             }
         }
 
         //链表记录节气信息
-        time=julian.kiloYearToTime(t,i==0?date->tm_year+1899:date->tm_year+1900);
-        date_tmp=localtime(&time);
-        list.append(date_tmp,false,true,i%2==0,i,t);
+        time = julian.kiloYearToTime(t, i == 0 ? date->tm_year + 1899
+                                               : date->tm_year + 1900);
+        date_tmp = localtime(&time);
+        list.append(date_tmp, false, true, i % 2 == 0, i, t);
     }
 }
 
 // 用以判断朔日的函数,返回true则太阳地心黄经大于月球地心黄经,即朔日在此后
-bool date_forward(double sun_longitude,double moon_longitude)
-{
+bool date_forward(double sun_longitude, double moon_longitude) {
     /* 判断逻辑
      * 当moon_longitude<sun_longitude时,由于时刻已经在朔日附近
      * 因而可以判断朔日在该时刻之后
@@ -142,90 +129,84 @@ bool date_forward(double sun_longitude,double moon_longitude)
      * 否则,大于20时候,度数相差过大,理论上只可能为moon_longitude已接近360,sun_longitude略微大于0
      * 此时实际上是月亮应当追赶太阳,因而朔日在此后
      */
-    return moon_longitude < sun_longitude ? true : (moon_longitude-sun_longitude >= 20);
+    return moon_longitude < sun_longitude
+               ? true
+               : (moon_longitude - sun_longitude >= 20);
 }
 
-void ShuoRi(int year)
-{
-    double t,t_end,end,t_middle;//采用二分法计算,t与t_end为间隔24h的两个时刻
+void ShuoRi(int year) {
+    double t, t_end, end,
+        t_middle; //采用二分法计算,t与t_end为间隔24h的两个时刻
     time_t time;
-    Date* date_tmp=new Date;
+    Date *date_tmp = new Date;
 
     //根据zhongqi_vec的最后一项(今年冬至)计算冬至下一日的0时刻
-    date_tmp->tm_year=list.zhongqi_vec[12]->year-1900;
-    date_tmp->tm_mon=list.zhongqi_vec[12]->mon-1;
-    date_tmp->tm_mday=list.zhongqi_vec[12]->day+1;
-    date_tmp->tm_hour=0;
-    date_tmp->tm_min=0;
-    date_tmp->tm_sec=0;
-    date_tmp->tm_isdst=-1;
-    time=mktime(date_tmp);
-    end=julian.getJulianKiloYear(time);
+    date_tmp->tm_year = list.zhongqi_vec[12]->year - 1900;
+    date_tmp->tm_mon = list.zhongqi_vec[12]->mon - 1;
+    date_tmp->tm_mday = list.zhongqi_vec[12]->day + 1;
+    date_tmp->tm_hour = 0;
+    date_tmp->tm_min = 0;
+    date_tmp->tm_sec = 0;
+    date_tmp->tm_isdst = -1;
+    time = mktime(date_tmp);
+    end = julian.getJulianKiloYear(time);
 
     // 计算去年冬至时刻的time
-    date_tmp->tm_year=list.zhongqi_vec[0]->year-1900;
-    date_tmp->tm_mon=list.zhongqi_vec[0]->mon-1;
-    date_tmp->tm_mday=list.zhongqi_vec[0]->day;
-    date_tmp->tm_hour=list.zhongqi_vec[0]->hour;
-    date_tmp->tm_min=list.zhongqi_vec[0]->min;
-    date_tmp->tm_sec=list.zhongqi_vec[0]->sec;
-    date_tmp->tm_isdst=-1;
-    time=mktime(date_tmp);
+    date_tmp->tm_year = list.zhongqi_vec[0]->year - 1900;
+    date_tmp->tm_mon = list.zhongqi_vec[0]->mon - 1;
+    date_tmp->tm_mday = list.zhongqi_vec[0]->day;
+    date_tmp->tm_hour = list.zhongqi_vec[0]->hour;
+    date_tmp->tm_min = list.zhongqi_vec[0]->min;
+    date_tmp->tm_sec = list.zhongqi_vec[0]->sec;
+    date_tmp->tm_isdst = -1;
+    time = mktime(date_tmp);
 
     delete date_tmp;
 
     // 定朔日
-    for(t=julian.getJulianKiloYear(time);t<=end;time+=25*day)
-    {
+    for (t = julian.getJulianKiloYear(time); t <= end; time += 25 * day) {
         // 每月长度为28-30天,因而每次循环前进25天
-        t=julian.getJulianKiloYear(time);
-        t_end=julian.getJulianKiloYear(time+day);
+        t = julian.getJulianKiloYear(time);
+        t_end = julian.getJulianKiloYear(time + day);
 
         // 太阳在月亮之前,月亮追赶,故朔日在后,t和t_end前进24h
-        while(date_forward(p.sun_longitude(t_end),p.moon_longitude(t_end)))
-        {
-            time+=day;
-            t=t_end;
-            t_end=julian.getJulianKiloYear(time+day);
+        while (date_forward(p.sun_longitude(t_end), p.moon_longitude(t_end))) {
+            time += day;
+            t = t_end;
+            t_end = julian.getJulianKiloYear(time + day);
         }
         // 太阳在月亮之后,月亮落后,故朔日在前,t和t_end后退24h(用以保险)
-        while(!date_forward(p.sun_longitude(t),p.moon_longitude(t)))
-        {
-            time-=day;
-            t_end=t;
-            t=julian.getJulianKiloYear(time);
+        while (!date_forward(p.sun_longitude(t), p.moon_longitude(t))) {
+            time -= day;
+            t_end = t;
+            t = julian.getJulianKiloYear(time);
         }
 
-        while(t_end-t>=delta)
-        {
-            t_middle=(t+t_end)/2;
-            if(date_forward(p.sun_longitude(t_middle),p.moon_longitude(t_middle)))
-            {
-                t=t_middle;
-            }
-            else
-            {
-                t_end=t_middle;
+        while (t_end - t >= delta) {
+            t_middle = (t + t_end) / 2;
+            if (date_forward(p.sun_longitude(t_middle),
+                             p.moon_longitude(t_middle))) {
+                t = t_middle;
+            } else {
+                t_end = t_middle;
             }
         }
         // 输出朔日信息
-        time=julian.kiloYearToTime(t,year-1);
-        date_tmp=localtime(&time);
-        list.append(date_tmp,true,false,false,-1,t);
+        time = julian.kiloYearToTime(t, year - 1);
+        date_tmp = localtime(&time);
+        list.append(date_tmp, true, false, false, -1, t);
     }
 }
 
-int main(int argc,char* argv[])
-{
+int main(int argc, char *argv[]) {
 
-    if(argc!=2)
-    {
-        printf("Usage: %s year\\n\n",argv[0]);
+    if (argc != 2) {
+        printf("Usage: %s year\\n\n", argv[0]);
         return 0;
     }
-    Date* date=input(argv[1]);
-    int year=date->tm_year+1900;
-    double begin,end;
+    Date *date = input(argv[1]);
+    int year = date->tm_year + 1900;
+    double begin, end;
 
     JieQi(date);
     ShuoRi(year);
@@ -240,7 +221,6 @@ int main(int argc,char* argv[])
 
     // 释放内存,使用List的析构函数
 
-
     delete date;
 
     return 0;
diff --git a/src/calendar.h b/src/calendar.h
index b17e0d5..73676f5 100644
--- a/src/calendar.h
+++ b/src/calendar.h
@@ -1,12 +1,12 @@
 #ifndef _CALENDAR_H_
 #define _CALENDAR_H_
 
-#include <iostream>
-#include <string>
 #include <ctime>
-#include <vector>
 #include <fstream>
+#include <iostream>
 #include <math.h>
+#include <string>
+#include <vector>
 using namespace std;
 
 extern double pi;
@@ -14,114 +14,110 @@ extern double delta;
 extern char jieqi[25][10];
 
 typedef struct tm Date;
-struct point
-{
-    int year,mon,day,hour,min,sec;
-    bool isShuo,isJieqi,isZhongqi;
-    int JieqiIndex,MonthIndex;
+struct point {
+    int year, mon, day, hour, min, sec;
+    bool isShuo, isJieqi, isZhongqi;
+    int JieqiIndex, MonthIndex;
     bool RunYue;
     double time;
-    point* next;
-
-    point(int year,int mon,int day,int hour,int min,int sec,bool isShuo,bool isJieqi,bool isZhongqi,int JieqiIndex,int MonthIndex,bool RunYue,double time)
-    {
-        this->year=year;
-        this->mon=mon;
-        this->day=day;
-        this->hour=hour;
-        this->min=min;
-        this->sec=sec;
-        this->isShuo=isShuo;
-        this->isJieqi=isJieqi;
-        this->isZhongqi=isZhongqi;
-        this->JieqiIndex=JieqiIndex;
-        this->MonthIndex=MonthIndex;
-        this->RunYue=RunYue;
-        this->time=time;
-        this->next=NULL;
+    point *next;
+
+    point(int year, int mon, int day, int hour, int min, int sec, bool isShuo,
+          bool isJieqi, bool isZhongqi, int JieqiIndex, int MonthIndex,
+          bool RunYue, double time) {
+        this->year = year;
+        this->mon = mon;
+        this->day = day;
+        this->hour = hour;
+        this->min = min;
+        this->sec = sec;
+        this->isShuo = isShuo;
+        this->isJieqi = isJieqi;
+        this->isZhongqi = isZhongqi;
+        this->JieqiIndex = JieqiIndex;
+        this->MonthIndex = MonthIndex;
+        this->RunYue = RunYue;
+        this->time = time;
+        this->next = NULL;
     }
 };
 
-class Julian
-{
-    private:
-        static double d[23][5];
+class Julian {
+  private:
+    static double d[23][5];
 
-        double dt_ext(int y,double jsd);
+    double dt_ext(int y, double jsd);
 
-        //计算力学时与世界时之差,传入年份
-        double delta_t(int y);
-    public:
-        // 计算儒略日
-        double getJulianDay(time_t time);
+    //计算力学时与世界时之差,传入年份
+    double delta_t(int y);
 
-        // 计算儒略千年数
-        double getJulianKiloYear(time_t time);
+  public:
+    // 计算儒略日
+    double getJulianDay(time_t time);
 
-        //儒略千年数转时间戳
-        time_t kiloYearToTime(double t,int year);
-};
-
-
-class parameter
-{
-    private:
+    // 计算儒略千年数
+    double getJulianKiloYear(time_t time);
 
-        // 计算地球日心黄经
-        double get_longitude(vector<double> l,double t);
+    //儒略千年数转时间戳
+    time_t kiloYearToTime(double t, int year);
+};
 
-        // 计算地球日心黄纬
-        double get_latitude(vector<double> b,double t);
+class parameter {
+  private:
+    // 计算地球日心黄经
+    double get_longitude(vector<double> l, double t);
 
-        double get_R(vector<double> r,double t);
+    // 计算地球日心黄纬
+    double get_latitude(vector<double> b, double t);
 
-        // 转换FK5误差,返回弧度制
-        double delta_FK5(double L,double B,double T);
+    double get_R(vector<double> r, double t);
 
-        //获取章动有关角
-        vector<double> get_angle(double T);
+    // 转换FK5误差,返回弧度制
+    double delta_FK5(double L, double B, double T);
 
-        //章动修正
-        double nutation(double T);
+    //获取章动有关角
+    vector<double> get_angle(double T);
 
-        //光行差修正,返回弧度制
-        double aberration(double R);
+    //章动修正
+    double nutation(double T);
 
-        // 获取地日运行参数,L为地球日心黄经,B为地球日心黄纬,R为地日距离
-        vector<vector<double>> get_parameters(double t);
+    //光行差修正,返回弧度制
+    double aberration(double R);
 
-    public:
+    // 获取地日运行参数,L为地球日心黄经,B为地球日心黄纬,R为地日距离
+    vector<vector<double>> get_parameters(double t);
 
-        double sun_longitude(double t);
+  public:
+    double sun_longitude(double t);
 
-        double moon_longitude(double t);
+    double moon_longitude(double t);
 };
 
-class List
-{
-    private:
-        point *head,*tail;//链表头尾指针
+class List {
+  private:
+    point *head, *tail; //链表头尾指针
+
+    bool later(point *a, point *b);
 
-        bool later(point* a,point* b);
+  public:
+    vector<point *> shuori_vec;  //记录各朔日的地址
+    vector<point *> zhongqi_vec; //记录各中气的地址
 
-    public:
-        vector<point*> shuori_vec; //记录各朔日的地址
-        vector<point*> zhongqi_vec;//记录各中气的地址
+    List();
+    ~List();
 
-        List();
-        ~List();
+    // 链表尾部插入
+    void append(Date *date, bool isShuo, bool isJieqi, bool isZhongqi,
+                int JieqiIndex, double time);
 
-        // 链表尾部插入
-        void append(Date* date,bool isShuo,bool isJieqi,bool isZhongqi,int JieqiIndex,double time);
-        
-        //对链表进行“排序”
-        void lunar_sort();
+    //对链表进行“排序”
+    void lunar_sort();
 
-        //置闰月
-        void Run();
+    //置闰月
+    void Run();
 
-        //输出链表内容
-        void output();
+    //输出链表内容
+    void output();
 };
 
 #endif
diff --git a/src/parameters.cpp b/src/parameters.cpp
index 8a99160..57d98c2 100644
--- a/src/parameters.cpp
+++ b/src/parameters.cpp
@@ -1,130 +1,126 @@
-#include "calendar.h"
 #include "parameters.h"
+#include "calendar.h"
 using namespace std;
 
 //凡无特殊说明的函数,全部返回弧度制
 
 // 计算地球日心黄经
-double parameter::get_longitude(vector<double> l,double t)
-{
-    double L=l[0];
-    for(int i=1;i<l.size();i++)
-    {
-        L+=l[i]*pow(t,i);
+double parameter::get_longitude(vector<double> l, double t) {
+    double L = l[0];
+    for (int i = 1; i < l.size(); i++) {
+        L += l[i] * pow(t, i);
     }
     //返回弧度制,太阳地心黄经=地球日心黄经+180°
-    return L+pi;
+    return L + pi;
 }
 
 // 计算地球日心黄纬
-double parameter::get_latitude(vector<double> b,double t)
-{
-    double B=b[0];
-    for(int i=1;i<b.size();i++)
-    {
-        B+=b[i]*pow(t,i);
+double parameter::get_latitude(vector<double> b, double t) {
+    double B = b[0];
+    for (int i = 1; i < b.size(); i++) {
+        B += b[i] * pow(t, i);
     }
     //地心黄纬=-太阳黄纬
     return -B;
 }
 
 // 计算地日距离,单位为天文单位
-double parameter::get_R(vector<double> r,double t)
-{
-    double R=r[0];
-    for(int i=1;i<r.size();i++)
-    {
-        R+=r[i]*pow(t,i);
+double parameter::get_R(vector<double> r, double t) {
+    double R = r[0];
+    for (int i = 1; i < r.size(); i++) {
+        R += r[i] * pow(t, i);
     }
     return R;
 }
 
 // 转换FK5误差
-double parameter::delta_FK5(double L,double B,double T)
-{
-    //L转角度制
-    L*=180/pi;
+double parameter::delta_FK5(double L, double B, double T) {
+    // L转角度制
+    L *= 180 / pi;
     //计算L',角度制
-    double L_p=L-1.397*T-0.00031*T*T;
+    double L_p = L - 1.397 * T - 0.00031 * T * T;
     //计算L',弧度制
-    L_p*=pi/180;
-    while(L_p<0)
-        L_p+=2*pi;
-    while(L_p>=2*pi)
-        L_p-=2*pi;
+    L_p *= pi / 180;
+    while (L_p < 0)
+        L_p += 2 * pi;
+    while (L_p >= 2 * pi)
+        L_p -= 2 * pi;
     //计算delta_L,单位为角秒
-    double delta_L=-0.09033+0.03916*(cos(L_p)+sin(L_p))*tan(B);
+    double delta_L = -0.09033 + 0.03916 * (cos(L_p) + sin(L_p)) * tan(B);
     //转换为弧度制
-    delta_L*=pi/(180*3600);
+    delta_L *= pi / (180 * 3600);
     return delta_L;
 }
 
 //章动有关角,结果均为角度制
-vector<double> parameter::get_angle(double T)
-{
+vector<double> parameter::get_angle(double T) {
     vector<double> ang;
     //平距角
-    ang.push_back(297.85036+445267.111480*T-0.0019142*T*T+T*T*T/189474);
+    ang.push_back(297.85036 + 445267.111480 * T - 0.0019142 * T * T +
+                  T * T * T / 189474);
     //日地平近点角
-    ang.push_back(357.52772+35999.050340*T-0.0001603*T*T-T*T*T/300000);
+    ang.push_back(357.52772 + 35999.050340 * T - 0.0001603 * T * T -
+                  T * T * T / 300000);
     //月球平近点角
-    ang.push_back(134.96298+477198.867398*T+0.0086972*T*T+T*T*T/56250);
+    ang.push_back(134.96298 + 477198.867398 * T + 0.0086972 * T * T +
+                  T * T * T / 56250);
     //月球纬度参数
-    ang.push_back(93.27191+483202.017538*T-0.0036825*T*T+T*T*T/327270);
+    ang.push_back(93.27191 + 483202.017538 * T - 0.0036825 * T * T +
+                  T * T * T / 327270);
     //黄道与月球平轨道交点黄经
-    ang.push_back(125.04452-1934.136261*T+0.0020708*T*T+T*T*T/450000);
+    ang.push_back(125.04452 - 1934.136261 * T + 0.0020708 * T * T +
+                  T * T * T / 450000);
     return ang;
 }
 
 //章动修正
-double parameter::nutation(double T)
-{
-    vector<double> ang=get_angle(T);
+double parameter::nutation(double T) {
+    vector<double> ang = get_angle(T);
     double sita;
-    double s,s1,s2;
-    double c,c1,c2;
-    double m,n,o,p,q;
-
-    s=c=0;
-    for(int i=0;i<nutation_size;i++)
-    {
-        sita=nutation_parameters[i][0]*ang[0]+nutation_parameters[i][1]*ang[1]+nutation_parameters[i][2]*ang[2]+nutation_parameters[i][3]*ang[3]+nutation_parameters[i][4]*ang[4];
-        sita*=pi/180;
-        s+=(nutation_parameters[i][5]+nutation_parameters[i][6]*T)*sin(sita);
-        //c+=(nutation_parameters[i][7]+nutation_parameters[i][8]*T)*cos(sita);
+    double s, s1, s2;
+    double c, c1, c2;
+    double m, n, o, p, q;
+
+    s = c = 0;
+    for (int i = 0; i < nutation_size; i++) {
+        sita = nutation_parameters[i][0] * ang[0] +
+               nutation_parameters[i][1] * ang[1] +
+               nutation_parameters[i][2] * ang[2] +
+               nutation_parameters[i][3] * ang[3] +
+               nutation_parameters[i][4] * ang[4];
+        sita *= pi / 180;
+        s += (nutation_parameters[i][5] + nutation_parameters[i][6] * T) *
+             sin(sita);
+        // c+=(nutation_parameters[i][7]+nutation_parameters[i][8]*T)*cos(sita);
     }
     // 计算得到的s和c单位0.0001秒,转换为弧度制
-    s*=0.0001;
-    s*=pi/(180*3600);
+    s *= 0.0001;
+    s *= pi / (180 * 3600);
     return s;
 }
 
 //光行差修正
-double parameter::aberration(double R)
-{
+double parameter::aberration(double R) {
     //公式,单位0.0001角秒
-    double delta=-20.4898/R;
+    double delta = -20.4898 / R;
     //转换为弧度制
-    delta*=pi/(180*3600);
+    delta *= pi / (180 * 3600);
     return delta;
 }
 
 // 获取地日运行参数,L为地球日心黄经,B为地球日心黄纬,R为地日距离
-vector<vector<double>> parameter::get_parameters(double t)
-{
-    double l=0;
-    double a,b,c,num_tmp=0;
+vector<vector<double>> parameter::get_parameters(double t) {
+    double l = 0;
+    double a, b, c, num_tmp = 0;
     vector<vector<double>> parameters;
     vector<double> tmp;
 
     //计算L
     tmp.resize(0);
-    for(int i=0;i<L_size;i++)
-    {
-        num_tmp=0;
-        for(int j=0;j<L_length[i];j++)
-        {
-            num_tmp+=L[i][j][0]*cos(L[i][j][1]+L[i][j][2]*t);
+    for (int i = 0; i < L_size; i++) {
+        num_tmp = 0;
+        for (int j = 0; j < L_length[i]; j++) {
+            num_tmp += L[i][j][0] * cos(L[i][j][1] + L[i][j][2] * t);
         }
         tmp.push_back(num_tmp);
     }
@@ -132,12 +128,10 @@ vector<vector<double>> parameter::get_parameters(double t)
 
     //计算B
     tmp.resize(0);
-    for(int i=0;i<B_size;i++)
-    {
-        num_tmp=0;
-        for(int j=0;j<B_length[i];j++)
-        {
-            num_tmp+=B[i][j][0]*cos(B[i][j][1]+B[i][j][2]*t);
+    for (int i = 0; i < B_size; i++) {
+        num_tmp = 0;
+        for (int j = 0; j < B_length[i]; j++) {
+            num_tmp += B[i][j][0] * cos(B[i][j][1] + B[i][j][2] * t);
         }
         tmp.push_back(num_tmp);
     }
@@ -145,18 +139,15 @@ vector<vector<double>> parameter::get_parameters(double t)
 
     //计算R
     tmp.resize(0);
-    for(int i=0;i<R_size;i++)
-    {
-        num_tmp=0;
-        for(int j=0;j<R_length[i];j++)
-        {
-            num_tmp+=R[i][j][0]*cos(R[i][j][1]+R[i][j][2]*t);
+    for (int i = 0; i < R_size; i++) {
+        num_tmp = 0;
+        for (int j = 0; j < R_length[i]; j++) {
+            num_tmp += R[i][j][0] * cos(R[i][j][1] + R[i][j][2] * t);
         }
         tmp.push_back(num_tmp);
     }
     parameters.push_back(tmp);
 
-
     /* 最终传参情况:
      * parameters[0]为L系列,用来计算地球日心黄经
      * parameters[1]为B系列,用来计算地球日心黄纬
@@ -166,71 +157,71 @@ vector<vector<double>> parameter::get_parameters(double t)
 }
 
 // 计算太阳地心黄经,外部调用,返回角度制
-double parameter::sun_longitude(double t)
-{
+double parameter::sun_longitude(double t) {
     //从文件中计算地日运行参数
-    vector<vector<double>> p=get_parameters(t);
+    vector<vector<double>> p = get_parameters(t);
 
     //取出各类参数
-    vector<double> l=p[0],b=p[1],r=p[2];
+    vector<double> l = p[0], b = p[1], r = p[2];
 
     //计算地球日心黄经纬,返回弧度制/天文单位
-    double L=get_longitude(l,t);
-    double B=get_latitude(b,t);
-    double R=get_R(r,t);
-
+    double L = get_longitude(l, t);
+    double B = get_latitude(b, t);
+    double R = get_R(r, t);
 
     //以下修正需要的都是儒略世纪数而非千年数
     //转FK5误差,返回弧度制
-    L+=delta_FK5(L,B,10*t);
+    L += delta_FK5(L, B, 10 * t);
     //章动修正,返回弧度制
-    L+=nutation(10*t);
+    L += nutation(10 * t);
     //光行差修正,返回弧度制
-    L+=aberration(R);
-
-
-    //L转角度制
-    L*=180/pi;
-    while(L<0)
-        L+=360;
-    while(L>=360)
-        L-=360;
+    L += aberration(R);
+
+    // L转角度制
+    L *= 180 / pi;
+    while (L < 0)
+        L += 360;
+    while (L >= 360)
+        L -= 360;
     return L;
 }
 
 // 计算月球地心黄经,外部调用,返回角度制
-double parameter::moon_longitude(double t)
-{
-    double T=10*t;
-    vector<double> angles=get_angle(T);
-    double a,b,c,d,moon_longitude_a;
-
-    double L=218.3164591+481267.88134236*T-0.0013268*T*T+T*T*T/538841-T*T*T*T/65194000;//月球平黄经
-    double EI=0,sita=0;
-    double E=1-0.002516*T-0.0000074*T*T;//地球离心率
-
-    for(int i=0;i<moon_size;i++)
-    {
-        sita=moon_longitude_parameters[i][0]*angles[0]+moon_longitude_parameters[i][1]*angles[1]+moon_longitude_parameters[i][2]*angles[2]+moon_longitude_parameters[i][3]*angles[3];
-        sita*=pi/180;
-        EI+=moon_longitude_parameters[i][4]*sin(sita)*pow(E,fabs(moon_longitude_parameters[i][1]));
+double parameter::moon_longitude(double t) {
+    double T = 10 * t;
+    vector<double> angles = get_angle(T);
+    double a, b, c, d, moon_longitude_a;
+
+    double L = 218.3164591 + 481267.88134236 * T - 0.0013268 * T * T +
+               T * T * T / 538841 - T * T * T * T / 65194000; //月球平黄经
+    double EI = 0, sita = 0;
+    double E = 1 - 0.002516 * T - 0.0000074 * T * T; //地球离心率
+
+    for (int i = 0; i < moon_size; i++) {
+        sita = moon_longitude_parameters[i][0] * angles[0] +
+               moon_longitude_parameters[i][1] * angles[1] +
+               moon_longitude_parameters[i][2] * angles[2] +
+               moon_longitude_parameters[i][3] * angles[3];
+        sita *= pi / 180;
+        EI += moon_longitude_parameters[i][4] * sin(sita) *
+              pow(E, fabs(moon_longitude_parameters[i][1]));
     }
 
     //地外行星影响月球地心黄经修正项
-    double a1,a2;
-    a1=119.75+131.849*T;
-    a2=53.09+479264.290*T;
+    double a1, a2;
+    a1 = 119.75 + 131.849 * T;
+    a2 = 53.09 + 479264.290 * T;
 
-    EI+=3958.0*sin(a1*pi/180);
-    EI+=1962.0*sin((L-angles[3])*pi/180);
-    EI+=318.0*sin(a2*pi/180);
+    EI += 3958.0 * sin(a1 * pi / 180);
+    EI += 1962.0 * sin((L - angles[3]) * pi / 180);
+    EI += 318.0 * sin(a2 * pi / 180);
 
-    L+=EI/1000000;
-    L+=180/pi*nutation(T);//地球章动修正
+    L += EI / 1000000;
+    L += 180 / pi * nutation(T); //地球章动修正
 
-    while(L<0)
-        L+=360;
-    while(L>=360)
-        L-=360;
+    while (L < 0)
+        L += 360;
+    while (L >= 360)
+        L -= 360;
     return L;
 }
diff --git a/test.sh b/test.sh
index 547054c..645eabe 100755
--- a/test.sh
+++ b/test.sh
@@ -8,36 +8,26 @@
 # Created Time : 2023-10-06
 ##########################################################################
 
-# 写一个脚本,测试已经生成的main的功能
-# 输入年份为自1976年至2076年的任意年份
 # 如果未出现段错误就重定向输出到res.txt,否则输出到err.txt,并在屏幕上显示出错的年份
 
 # 设置要测试的可执行文件
 executable="main"
 
-# 清空res.txt和err.txt
 echo "" > res.txt
 
-# 循环测试年份,计算总用时为多少秒
 start_time=$(date +%s)
-for year in {1900..2100}; do
+for year in {1800..2200}; do
     echo "==================测试年份 $year====================="
-    
-    # 执行可执行文件,并捕获标准输出和标准错误
+
     output=$(./$executable "$year" 2>&1)
 
-    # 获取命令的退出状态码
     exit_code=$?
-
     if [ $exit_code -eq 0 ]; then
-        # 执行正常,将输出重定向到res.txt
         echo -e "$year:\n$output" >> res.txt
-        # echo "执行正常"
     else
         # 执行异常,将错误信息重定向到err.txt
         echo -e "$year:\n$output" >> err.txt
         echo "执行异常(退出码: $exit_code)"
-        # 停止执行
         exit 1
     fi
 done
-- 
cgit v1.2.3-70-g09d2