• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 183,  comments - 10,  trackbacks - 0
             
             1 def my_range(start, stop = None, step = 1):
             2     # 實現自己的 range
             3     if stop == None:
             4         start, stop = 0, start
             5 
             6     result = []
             7     if step > 0:
             8         i = start
             9         while i < stop:
            10             result.append(i)
            11             i += step
            12     else:
            13         i = start
            14         while (i > stop):
            15             result.append(i)
            16             i += step
            17     return result
            18 
            19 print(my_range(10))
            20 print(my_range(5202))
            21 print(my_range(110))
            22 print(my_range(10, 0, -1))
            23 print(my_range(100, 0, -9))

            輸出:
            >>>
            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
            [5, 7, 9, 11, 13, 15, 17, 19]
            [1, 2, 3, 4, 5, 6, 7, 8, 9]
            [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
            [100, 91, 82, 73, 64, 55, 46, 37, 28, 19, 10, 1]
            posted @ 2013-05-16 21:00 unixfy 閱讀(383) | 評論 (0)編輯 收藏
             1 def init(data):
             2     data['first'= {}
             3     data['middle'= {}
             4     data['last'= {}
             5 
             6 def lookup(data, label, name):
             7     return data[label].get(name)
             8 
             9 def store(data, full_name):
            10     names = full_name.split()
            11     if len(names) == 2:
            12         names.insert(1'')
            13     labels = 'first''middle''last'
            14     for label, name in zip(labels, names):
            15         people = lookup(data, label, name)
            16         if people:
            17             people.append(full_name)
            18         else:
            19             data[label][name] = [full_name]
            20 
            21 my_names = {}
            22 init(my_names)
            23 store(my_names, 'Magnus Lie Hetland')
            24 print(my_names)
            25 print(lookup(my_names, 'middle''Lie'))
            26 
            27 store(my_names, 'Robin Hood')
            28 store(my_names, 'Robin Locksley')
            29 print(my_names)
            30 print(lookup(my_names, 'first''Robin'))
            31 store(my_names, 'Mr. Gumby')
            32 print(my_names)
            33 print(lookup(my_names, 'middle'''))
            34 

            輸出:
            >>>
            {'middle': {'Lie': ['Magnus Lie Hetland']}, 'first': {'Magnus': ['Magnus Lie Hetland']}, 'last': {'Hetland': ['Magnus Lie Hetland']}}
            ['Magnus Lie Hetland']
            {'middle': {'': ['Robin Hood', 'Robin Locksley'], 'Lie': ['Magnus Lie Hetland']}, 'first': {'Robin': ['Robin Hood', 'Robin Locksley'], 'Magnus': ['Magnus Lie Hetland']}, 'last': {'Hetland': ['Magnus Lie Hetland'], 'Locksley': ['Robin Locksley'], 'Hood': ['Robin Hood']}}
            ['Robin Hood', 'Robin Locksley']
            {'middle': {'': ['Robin Hood', 'Robin Locksley', 'Mr. Gumby'], 'Lie': ['Magnus Lie Hetland']}, 'first': {'Mr.': ['Mr. Gumby'], 'Robin': ['Robin Hood', 'Robin Locksley'], 'Magnus': ['Magnus Lie Hetland']}, 'last': {'Hetland': ['Magnus Lie Hetland'], 'Locksley': ['Robin Locksley'], 'Gumby': ['Mr. Gumby'], 'Hood': ['Robin Hood']}}
            ['Robin Hood', 'Robin Locksley', 'Mr. Gumby']


            改進:利用收集參數,一次可以添加多個名字 strage_2
             1 def init(data):
             2     data['first'= {}
             3     data['middle'= {}
             4     data['last'= {}
             5 
             6 def lookup(data, label, name):
             7     return data[label].get(name)
             8 
             9 def store(data, full_name):
            10     names = full_name.split()
            11     if len(names) == 2:
            12         names.insert(1'')
            13     labels = 'first''middle''last'
            14     for label, name in zip(labels, names):
            15         people = lookup(data, label, name)
            16         if people:
            17             people.append(full_name)
            18         else:
            19             data[label][name] = [full_name]
            20 
            21 def store_2(data, *full_names):
            22     for full_name in full_names:
            23         names = full_name.split()
            24         if len(names) == 2:
            25             names.insert(1'')
            26         labels = 'first''middle''last'
            27         for label, name in zip(labels, names):
            28             people = lookup(data, label, name)
            29             if people:
            30                 people.append(full_name)
            31             else:
            32                 data[label][name] = [full_name]
            33 
            34 my_names = {}
            35 init(my_names)
            36 store(my_names, 'Magnus Lie Hetland')
            37 print(my_names)
            38 print(lookup(my_names, 'middle''Lie'))
            39 
            40 store(my_names, 'Robin Hood')
            41 store(my_names, 'Robin Locksley')
            42 print(my_names)
            43 print(lookup(my_names, 'first''Robin'))
            44 store(my_names, 'Mr. Gumby')
            45 print(my_names)
            46 print(lookup(my_names, 'middle'''))

            posted @ 2013-05-16 20:12 unixfy 閱讀(231) | 評論 (0)編輯 收藏
            1 def foo():
            2     x = 5
            3     for i in range(3):
            4         print(i)
            5 for i in range(1013):
            6     print(i)
            7 
            8 foo()

            輸出:
            >>>
            10
            11
            12
            0
            1
            2


            1 def foo():
            2     x = 5
            3     for i in range(3):
            4         print(i)
            5     for i in range(1013):
            6         print(i)
            7 
            8 foo()

            輸出:
            >>>
            0
            1
            2
            10
            11
            12





            posted @ 2013-05-16 19:54 unixfy 閱讀(165) | 評論 (0)編輯 收藏
            類似于C++中的引用計數
             1 >>> x = 5
             2 >>> y = x
             3 >>> x == y
             4 True
             5 >>> x is y
             6 True
             7 >>> y = 3
             8 >>> x == y
             9 False
            10 >>> x is y
            11 False

             1 >>> x = 5
             2 >>> y = x
             3 >>> x == y
             4 True
             5 >>> x is y
             6 True
             7 >>> y = 5
             8 >>> x == y
             9 True
            10 >>> x is y
            11 True
            12 >>> y = 3
            13 >>> x == y
            14 False
            15 >>> x is y
            16 False


            posted @ 2013-05-16 19:21 unixfy 閱讀(87) | 評論 (0)編輯 收藏
             1 from math import sqrt
             2 
             3 def is_prim(n):
             4     if n < 2:
             5         return False
             6     for i in range(2, int(sqrt(n)) + 1):
             7         if n % i == 0:
             8             return False
             9     return True
            10 
            11 def get_prim(n):
            12     if n < 1:
            13         return None
            14     x = 1
            15     r = 3
            16     ret = 2
            17     while x < n:
            18         if is_prim(r) == True:
            19             x = x + 1
            20             ret = r
            21         r = r + 1
            22     return ret
            23 
            24 = int(input("Input n: "))
            25 print(get_prim(n))
            26 
            posted @ 2013-05-14 22:25 unixfy 閱讀(891) | 評論 (0)編輯 收藏
             1 people = {
             2     'Alice' : {
             3         'phone' : '2341',
             4         'addr'  : 'Foo drive 23'
             5         },
             6     'Beth' : {
             7         'phone' : '9102',
             8         'addr'  : 'Bar street 42'
             9         },
            10     'Cecil' : {
            11         'phone' : '3158',
            12         'addr'  : 'Baz avenue 90'
            13         }
            14     }
            15 
            16 labels = {
            17     'phone' : 'phone number',
            18     'addr'  : 'address'
            19     }
            20 
            21 name = input("Name:")
            22 
            23 request = input("phone number(p) or address(a)?")
            24 
            25 if request == 'p' : key = 'phone'
            26 if request == 'a' : key = 'addr'
            27 
            28 if name in people :
            29     print("%s's %s is %s." % (name, labels[key], people[name][key]))
            30 

            get 函數,提供默認值
             1 people = {
             2     'Alice' : {
             3         'phone' : '2341',
             4         'addr'  : 'Foo drive 23'
             5         },
             6     'Beth' : {
             7         'phone' : '9102',
             8         'addr'  : 'Bar street 42'
             9         },
            10     'Cecil' : {
            11         'phone' : '3158',
            12         'addr'  : 'Baz avenue 90'
            13         }
            14     }
            15 
            16 labels = {
            17     'phone' : 'phone number',
            18     'addr'  : 'address'
            19     }
            20 
            21 name = input("Name:")
            22 
            23 request = input("phone number(p) or address(a)?")
            24 
            25 key = request
            26 if request == 'p' : key = 'phone'
            27 if request == 'a' : key = 'addr'
            28 
            29 person = people.get(name, {})
            30 label  = labels.get(key, key)
            31 result = person.get(key, 'not available')
            32 
            33 print("%s's %s is %s." % (name, label, result))
            34 


            posted @ 2013-05-12 22:50 unixfy 閱讀(146) | 評論 (0)編輯 收藏
            Box
             1 sentence = input("Sentence: ")
             2 
             3 screen_width = 80
             4 text_width   = len(sentence)
             5 box_width    = text_width + 6
             6 left_margin  = int((screen_width - box_width) / 2)
             7 
             8 print()
             9 print(' ' * left_margin + '+' + '-' * (box_width-4+ '+')
            10 print(' ' * left_margin + '' + ' ' * text_width + ' |')
            11 print(' ' * left_margin + '' + sentence + ' |')
            12 print(' ' * left_margin + '' + ' ' * text_width + ' |')
            13 print(' ' * left_margin + '+' + '-' * (box_width-4+ '+')
            14 print()
            15 
            posted @ 2013-05-12 15:28 unixfy 閱讀(122) | 評論 (0)編輯 收藏
            《Python 基礎教程》
             1 months = [
             2     'January',
             3     'February',
             4     'March',
             5     'April',
             6     'May',
             7     'June',
             8     'July',
             9     'August',
            10     'September',
            11     'October',
            12     'November',
            13     'December'
            14     ]
            15 
            16 # print(month)
            17 
            18 endings = ['st''nd''rd'+ 17 * ['th'] \
            19         + ['st''nd''rd'+ 7  * ['th'] \
            20         + ['st']
            21 
            22 year  = input("Year: ")
            23 month = input("Month: ")
            24 day   = input("Day: ")
            25 
            26 month_number = int(month)
            27 day_number   = int(day)
            28 
            29 month_name   = months[month_number-1]
            30 ordinal      = day + endings[day_number-1]
            31 
            32 # print(1, 2, 3)
            33 print(month_name + ' ' + ordinal + '' + year)
            34 

            posted @ 2013-05-12 14:05 unixfy 閱讀(173) | 評論 (0)編輯 收藏
             

            互聯網上的商業模式

             

            商業模式經濟上、商業上的定義我不知道。我所理解的商業模式就是“賺錢的模式”。

            “男怕入錯行,女怕嫁錯郎”,對于學計算機的人,想從事IT這個行業的人,以及正在這個行業工作的人都需要思考這個問題:互聯網這個行業怎么樣,它可以使這個行業的人能夠實現自己的價值嗎?

             

            史玉柱說過網絡游戲是目前中國互聯網上最好的商業模式,這是他好多年前說的,但是到目前為止,這句話依然有效,目前中國互聯網行業依然是互聯網上最好的商業模式,目前雖然電子商務發展的很好,但是它是燒錢的而不是賺錢,這種燒錢模式不知道會持續多久。

            目前中國幾大互聯網公司,雖然其主營業務看起來不是網絡游戲,但是實質上都是以網絡游戲生存著的。騰訊是中國互聯網上收入最多的公司,其游戲收入比重占了一半以上,網易有一半以上的收入也是來自網絡游戲,搜狐暢游、盛大、金山、人人等。

             

            百度不是靠游戲為生的,競價排名是一直被人所詬病的,排除廣告的因素,競價排名確實是一種很好的賺錢模式,使得百度收入逐年增高。

             

            360 是一家很好的公司,其倡導免費模式,在推出了安全瀏覽器和網址導航后開始了一些盈利。

            現在很多人的觀點是一定要先免費,增加用戶量,用戶上去了自然而然就會有賺錢模式。我并不認同這種觀點,因為并不是每個人都是周鴻祎,在你用戶還沒上去之前你的公司可能早已經死了,所以別人可以做的事,并不代表你可以做。別人可以先做用戶量,別人可以拿到天使投資、風險投資,而你并不一定拿到。

            最保險的方法就是在你的公司初創時期就考慮怎么賺錢,怎么能生成下去。

             

            視頻網站也是中國互聯網上一個比較打的模式,視頻網站也是很燒錢,現在優酷做起來了,開始有了自己的廣告、收費視頻節目、自制的一些節目(曉說、潘石屹、財經類等),但是中國互聯網上也盡只有優酷、愛奇藝、搜狐視頻等幾家公司。

             

            電子商務被很多人看好,已經迅猛發展很多年了。前幾天的雙11淘寶-天貓銷售額達到191億,這個數字是龐大的。

            目前國內電子商務模式主要有三種:阿里的平臺式;京東、亞馬遜、一號店、當當等這種沃爾瑪、國美式;還有一種是自做品牌的如凡客、樂淘等。在我看來,這三種模式更看好平臺式的,電子商務的精髓在于電子,而非商務,因為商務早就存在,所以沒有必要再創造出一個新的電子的品牌。能夠體現電子的,就是讓線下的東西能夠通過電子的方式銷售,而淘寶-天貓就是做的這個。

             

            計算機發展到現在,在我看來主要是三個部分:硬件、軟件、互聯網。比爾蓋茨的軟件模式是一個非常好的模式,一直到現在為止依然是微軟、甲骨文這些公司。

             

            關于風險投資,我想風險投資是隨著計算機互聯網發展起來的,如果一家創始人從創辦開始就可以自負盈虧、贏利,那么它為什么要為了一點資金而稀釋自己的股份,風投之所以伴隨著互聯網的發展是因為互聯網公司一開始就沒有造血的功能,需要不斷的供血,不斷的供血,知道能夠上市或者被收購,這樣給風投者以巨大的回報。

            我個人并不看好這種模式,因為能夠拉到風投不是一般人能為之的,另外,即便拉到風投成功的也很少,這不是一條理性的道路。

             

            我理想的創業模式是那種傳統軟件的模式,一開始就可以自負盈虧,自己靠自己生存,和風投沒有關系,按照自己的步調走。

            /Files/unixfy/互聯網上的商業模式_mark.doc

            posted @ 2012-11-22 10:33 unixfy 閱讀(151) | 評論 (0)編輯 收藏

            統一的考勤處理程序

            總共分為 6 個處理步驟,如下:
            0. 進行考勤數據的預處理,其中有篩選打卡成功的記錄,并對成功的記錄進行排序。這一步比較靈活,根據不同的考勤數據做不同的預處理以得到后續可以處理的數據。
            1. 針對打卡成功的考勤記錄,找出每天的最早時間和最晚時間。
            2. 根據最早時間和最晚時間得到遲到和早退記錄。
            3. 由于可能存在缺勤的情況,所以需要在制定工作日內找到未存在考勤記錄的記錄,作為缺勤記錄。
            4. 將前面的遲到和早退記錄與缺勤記錄進行整合。
            5. 根據整合的結果輸出考勤異常的記錄。輸出有多種形式,前面的遲到、早退、缺勤等數據一定了,這里的輸出格式可以按照:按人名-行輸出、按人名-列輸出、按日期-行輸出、按日期-列輸出、人名-日期輸出、日期-人名輸出等多種方式。

            具體的程序實現如下:
            0.
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <string>
            #include <vector>
            #include <algorithm>
            using namespace std;

            int main()
            {
             ifstream fin_kaoqin("kaoqin.txt");
             ofstream fout_0("0.txt");
             if (!fin_kaoqin || !fout_0)
             {
              cerr << "File error!" << endl;
              system("PAUSE");
              exit(1);
             }
             vector<string> checkins;
             string name, date, time;
             string s1, s2, s3, ind;
             string line;
             while (getline(fin_kaoqin, line))
             {
              istringstream sin(line);
              sin >> s1 >> s2 >> name >> date >> time >> s3 >> ind;
              if (ind != "成功")
              {
               continue;
              }
              checkins.push_back(name + '\t' + date + '\t' + time);
             }
             sort(checkins.begin(), checkins.end());
             for (vector<string>::size_type i = 0; i != checkins.size(); ++i)
             {
              fout_0 << checkins[i] << endl;
             }
             fin_kaoqin.close();
             fout_0.close();
             return 0;
            }

            1.
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <map>
            #include <set>
            #include <vector>
            #include <string>
            using namespace std;

            int main()
            {
             ifstream fin("0.txt");
             ofstream fout("1.txt");
             ofstream fout_names("names.txt");
             ofstream fout_dates("dates.txt");
             if (!fin || !fout || !fout_names || !fout_dates)
             {
              cerr << "File error!" << endl;
              system("PAUSE");
              exit(1);
             }
             map<string, vector<string> > checkins;
             set<string> names, dates;
             string line;
             string name, date, time;
             while (getline(fin, line))
             {
              istringstream sin(line);
              sin >> name >> date >> time;
              names.insert(name);
              dates.insert(date);
              checkins[name + '\t' + date].push_back(time);
             }
             string earliest, lastest;
             for (map<string, vector<string> >::const_iterator cit = checkins.begin(); cit != checkins.end(); ++cit)
             {
              earliest = lastest = cit->second[0];
              for (vector<string>::size_type i = 0; i != cit->second.size(); ++i)
              {
               if (earliest > cit->second[i])
               {
                earliest = cit->second[i];
               }
               else if (lastest < cit->second[i])
               {
                lastest = cit->second[i];
               }
              }
              fout << cit->first << '\t' << earliest << endl;
              fout << cit->first << '\t' << lastest  << endl;
             }
             for (set<string>::const_iterator cit = names.begin(); cit != names.end(); ++cit)
             {
              fout_names << *cit << endl;
             }
             for (set<string>::const_iterator cit = dates.begin(); cit != dates.end(); ++cit)
             {
              fout_dates << *cit << endl;
             }
             fin.close();
             fout.close();
             fout_names.close();
             fout_dates.close();
             return 0;
            }

            2.
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <string>
            using namespace std;

            struct checkin
            {
             string name;
             string date;
             string time;
            };

            void foo(ofstream& fout_nor, ofstream& fout_abn, const checkin& ci1, const checkin& ci2, const string& start, const string& end)
            {
             if (ci1.time <= start)
             {
              fout_nor << ci1.name << '\t' << ci1.date << '\t' << ci1.time << endl;
             }
             else
             {
              fout_abn << ci1.name << '\t' << ci1.date << '\t' << ci1.time << "遲到" << endl;
             }
             if (ci2.time >= end)
             {
              fout_nor << ci2.name << '\t' << ci2.date << '\t' << ci2.time << endl;
             }
             else
             {
              fout_abn << ci2.name << '\t' << ci2.date << '\t' << ci2.time << "早退" << endl;
             }
            }

            int main()
            {
             ifstream fin("1.txt");
             ofstream fout_nor("2-normal.txt"), fout_abn("2-abnormal.txt");
             if (!fin || !fout_nor || !fout_abn)
             {
              cerr << "File error!" << endl;
              system("PAUSE");
              exit(1);
             }
             string line1, line2;
             checkin ci1, ci2;
             string start = "083000", end = "173000";
             while (getline(fin, line1) && getline(fin, line2))
             {
              istringstream sin1(line1), sin2(line2);
              sin1 >> ci1.name >> ci1.date >> ci1.time;
              sin2 >> ci2.name >> ci2.date >> ci2.time;
              foo(fout_nor, fout_abn, ci1, ci2, start, end);
             }
             fin.close();
             fout_nor.close();
             fout_abn.close();
             return 0;
            }

            3.
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <string>
            #include <map>
            #include <set>
            #include <vector>
            using namespace std;

            int main()
            {
             ifstream fin_ci("0.txt");
             ifstream fin_name("names-filter.txt");
             ifstream fin_date("dates-filter.txt");
             ofstream fout_nowork("2.1-nowork.txt");
             if (!fin_ci || !fin_name || !fin_date || !fout_nowork)
             {
              cerr << "File error!" << endl;
              system("PAUSE");
              exit(1);
             }
             map<string, set<string> > name_date;
             string line, name, date;
             while (getline(fin_ci, line))
             {
              istringstream sin(line);
              sin >> name >> date;
              name_date[name].insert(date);
             }
             vector<string> names;
             while (fin_name >> line)
             {
              names.push_back(line);
             }
             vector<string> dates;
             while (fin_date >> line)
             {
              dates.push_back(line);
             }
             for (vector<string>::size_type i = 0; i != names.size(); ++i)
             {
              for (vector<string>::size_type j = 0; j != dates.size(); ++j)
              {
               if (name_date[names[i]].find(dates[j]) == name_date[names[i]].end())
               {
                fout_nowork << names[i] << '\t' << dates[j] << '\t' << "無出勤記錄!" << endl;
               }
              }
             }
             fin_ci.close();
             fin_name.close();
             fin_date.close();
             fout_nowork.close();
             return 0;
            }

            4.
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <string>
            #include <vector>
            #include <algorithm>
            using namespace std;

            int main()
            {
             ifstream fin_abnormal("2-abnormal.txt");
             ifstream fin_nowork("2.1-nowork.txt");
             ofstream fout_excep("2.2-exception.txt");
             if (!fin_abnormal || !fin_nowork || !fout_excep)
             {
              cerr << "File error!" << endl;
              system("PAUSE");
              exit(1);
             }
             vector<string> checkins;
             string line;
             while (getline(fin_abnormal, line))
             {
              checkins.push_back(line);
             }
             while (getline(fin_nowork, line))
             {
              checkins.push_back(line);
             }
             sort(checkins.begin(), checkins.end());
             for (vector<string>::size_type i = 0; i != checkins.size(); ++i)
             {
              fout_excep << checkins[i] << endl;
             }
             fin_abnormal.close();
             fin_nowork.close();
             fout_excep.close();
             return 0;
            }

            5.
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <string>
            #include <map>
            #include <set>
            #include <vector>
            using namespace std;

            struct date_time
            {
             string date;
             string time;
            };

            int main()
            {
             ifstream fin_ci("2.2-exception.txt");
             ifstream fin_names("names-filter.txt");
             ifstream fin_dates("dates-filter.txt");
             ofstream fout_row("3-name-row-filter.txt");
             ofstream fout_col("3-name-column-filter.txt");
             if (!fin_ci || !fout_row || !fout_col || !fin_names || !fin_dates)
             {
              cerr << "File error!" << endl;
              system("PAUSE");
              exit(1);
             }
             map<string, vector<date_time> > bypers;
             vector<string> names;
             string line, name;
             date_time dt;
             int MAXNUM = 0;
             // 讀取想要的人名
             set<string> names_filter;
             while (fin_names >> name)
             {
              names_filter.insert(name);
             }
             // 讀取想要的日期
             set<string> dates_filter;
             while (fin_dates >> line)
             {
              dates_filter.insert(line);
             }
             while (getline(fin_ci, line))
             {
              istringstream sin(line);
              sin >> name >> dt.date >> dt.time;
              // 提取想要的人名和日期
              if (names_filter.find(name) == names_filter.end() || dates_filter.find(dt.date) == dates_filter.end())
              {
               continue;
              }
              bypers[name].push_back(dt);
             }
             // 同名字下相同日期的合并
             for (map<string, vector<date_time> >::iterator cit = bypers.begin(); cit != bypers.end(); ++cit)
             {
              // 提取名字
              names.push_back(cit->first);
              
              vector<date_time> tmp, hold = cit->second;
              vector<date_time>::size_type i = 0;
              while (i < hold.size() - 1)
              {
               if (hold[i].date == hold[i+1].date)
               {
                dt.date = hold[i].date;
                dt.time = hold[i].time + hold[i + 1].time;
                tmp.push_back(dt);
                i += 2;
               }
               else
               {
                dt.date = hold[i].date;
                dt.time = hold[i].time;
                tmp.push_back(dt);
                ++i;
               }
              }
              // 最后兩個如果相等,那么 i 一下子回跳到 hold.size()。
              // 如果不相等,那么 i 變成 hold.size() - 1, 推出循環。
              // 也就是說推出循環有兩種情況,分別是 i 為 hold.size() 和 hold.size() - 1
              // i 為 hold.size() 的情況沒有遺漏記錄,i 為 hold.size() - 1 遺漏了數據,所以在此補充。
              if (i == hold.size() - 1)
              {
               dt.date = hold[i].date;
               dt.time = hold[i].time;
               tmp.push_back(dt);
               ++i;
              }
              // 記錄最大記錄個數
              if (MAXNUM < tmp.size())
              {
               MAXNUM = tmp.size();
              }
              cit->second = tmp;
             }
             // 按行輸出
             for (map<string, vector<date_time> >::const_iterator cit = bypers.begin(); cit != bypers.end(); ++cit)
             {
              fout_row << cit->first << '\t';
              for (vector<date_time>::size_type i = 0; i != cit->second.size(); ++i)
              {
               fout_row << cit->second[i].date << '\t' << cit->second[i].time << '\t';
              }
              fout_row << endl;
             }
             
             // 先輸出人名
             for (vector<string>::size_type i = 0; i != names.size(); ++i)
             {
              fout_col << names[i] << '\t';
             }
             fout_col << endl;
             // 按列輸出
             for (int i = 0; i != MAXNUM; ++i)
             {
              for (vector<string>::size_type j = 0; j != names.size(); ++j)
              {
               if (bypers[names[j]].size() > i)
               {
                fout_col << bypers[names[j]][i].date << ',' << bypers[names[j]][i].time << '\t';
               }
               else
               {
                fout_col /* << "XXXXXX" */ << '\t';
                // 這里的輸出 "XXXXXX" 可以省略,即可以直接 fout_col << '\t';
               }
              }
              fout_col << endl;
             }
             fin_ci.close();
             fout_row.close();
             fout_col.close();
             return 0;
            }

            posted @ 2012-10-29 17:04 unixfy 閱讀(162) | 評論 (0)編輯 收藏
            僅列出標題
            共19頁: 1 2 3 4 5 6 7 8 9 Last 
            免费精品久久天干天干| 久久久综合九色合综国产| 成人综合伊人五月婷久久| 中文字幕久久精品无码| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 久久无码精品一区二区三区| 国产精品99精品久久免费| 亚洲国产精品无码久久一线 | 99久久免费国产特黄| 久久人爽人人爽人人片AV| 麻豆成人久久精品二区三区免费| 亚洲综合精品香蕉久久网| 色综合久久久久久久久五月| 亚洲国产精品无码久久久不卡| 久久久国产精华液| 久久久精品人妻一区二区三区四| 97久久超碰国产精品旧版| 久久青青草原综合伊人| 久久久久无码国产精品不卡| 无码人妻少妇久久中文字幕| 亚洲午夜久久久影院伊人| 久久99精品国产自在现线小黄鸭| 国产精品久久久天天影视| 精品久久久久久无码人妻蜜桃| 国产精品久久久久久久人人看| 丰满少妇高潮惨叫久久久| 久久精品国产精品亚洲艾草网美妙 | 国内精品久久久久影院免费| 久久99精品免费一区二区| 国产精品久久久久蜜芽| 国内精品久久久久| 一本久久综合亚洲鲁鲁五月天| 国产午夜免费高清久久影院| 久久综合久久性久99毛片| 人妻精品久久无码区| 久久久久久国产精品无码下载 | 久久国产AVJUST麻豆| 久久精品国产99国产电影网| 久久人妻AV中文字幕| 久久久久国产精品| 伊人久久大香线蕉综合影院首页|