• <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>

            積木

            No sub title

              C++博客 :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
              140 Posts :: 1 Stories :: 11 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(1)

            我參與的團(tuán)隊(duì)

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            #

            原文轉(zhuǎn)自:http://chenfeie.st.dprktimes.com/vc/_mfc_ctreectrl.3a3a.create.htm

            CTreeCtrl::Create

            BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

            返回值

            Nonzero if initialization was successful; otherwise 0.

            如果初始化成功則返回非零值;否則返回0

            參數(shù)說(shuō)明

            dwStyle

            Specifies the tree view control’s style. Apply any combination of tree view control styles to the control.

            指定tree view控件的風(fēng)格。可以對(duì)這個(gè)控件使用tree view控件風(fēng)格的任意組合。

            rect

            Specifies the tree view control’s size and position. It can be either a CRect object or a RECT structure.

            指定tree view控件的尺寸和位置。此參數(shù)可以是一個(gè)CRect對(duì)象或一個(gè)RECT結(jié)構(gòu)。

            pParentWnd

            Specifies the tree view control’s parent window, usually a CDialog. It must not be NULL.

            指定tree view控件的父窗口,通常是一個(gè)CDialog。它不能是NULL。

            nID

            Specifies the tree view control’s ID.

            指定tree view控件的ID。

            備注

            If you specify the tree control in a dialog box template, or if you are using CTreeView, your tree control is created automatically when the dialog box or view is created. If you want to create the tree control as a child window of some other window, use the Create member function. If you create the tree control using Create, you must pass it WS_VISIBLE, in addition to other tree view styles.

            You construct a CTreeCtrl in two steps. First call the constructor, then call Create, which creates the tree view control and attaches it to the CTreeCtrl object.

            構(gòu)造一個(gè)CTreeCtrl要分兩步。首先調(diào)用構(gòu)造函數(shù),然后調(diào)用Create來(lái)創(chuàng)建這個(gè)tree view控件并將它與該CTeeCtrl對(duì)象連接

            The following styles can be applied to a tree view control:

            下面的風(fēng)格可以應(yīng)用到一個(gè)tree view控件

            • TVS_HASLINES   The tree view control has lines linking child items to their corresponding parent items.

              TVS_HASLINES tree view控件的子項(xiàng)與它們的父項(xiàng)之間用線連接。
            • TVS_LINESATROOT   The tree view control has lines linking child items to the root of the hierarchy.

              TVS_LINESATROOT tree view控件用線連接子項(xiàng)和根項(xiàng)。
            • TVS_HASBUTTONS   The tree view control adds a button to the left of each parent item.

              TVS_HASBUTTONS tree view在每一個(gè)父項(xiàng)的左邊添加一個(gè)按鈕。
            • TVS_EDITLABELS   The tree view control allows the user to edit the labels of tree view items.

              TVS_EDITLABELS tree view控件允許用戶編輯tree view項(xiàng)的標(biāo)簽。
            • TVS_SHOWSELALWAYS   Causes a selected item to remain selected when the tree-view control loses focus.

              TVS_SHOWSELALWAYS 當(dāng)tree view失去焦點(diǎn)時(shí),使被選擇的項(xiàng)仍然保持被選擇
            • TVS_DISABLEDRAGDROP   The tree-view control is prevented from  sending TVN_BEGINDRAG notification messages.

              TVS_DISABLEDRAGDROP 該tree view控件被禁止發(fā)送TVN_BEGINDRAG通知消息。
            • TVS_NOTOOLTIPS   The tree view control uses no tooltips.

              TVS_NOTOOLTIPS tree view控件使用工具提示。
            • TVS_SINGLEEXPAND   When this style is enabled, changing the selection in the tree view will automatically cause the item being selected to expand and the item being unselected to collapse. If the mouse is used to single-click the selected item and that item is closed, it will be expanded. If the selected item is single-clicked when it is open, it will be collapsed.

              TVS_SINGLEEXPAND 當(dāng)使用這個(gè)風(fēng)格時(shí),改變?cè)趖ree view中的選擇將導(dǎo)致正被選擇的項(xiàng)展開(kāi),而沒(méi)有被選擇的項(xiàng)收縮。如果用鼠標(biāo)單擊被選擇的項(xiàng),并且該項(xiàng)是關(guān)閉的,則該項(xiàng)就會(huì)展開(kāi)。如果該被選擇的項(xiàng)被單擊時(shí)是打開(kāi)的,則它就會(huì)收縮。
            posted @ 2011-10-01 18:44 Jacc.Kim 閱讀(3187) | 評(píng)論 (0)編輯 收藏

            原文參考自:http://blog.csdn.net/tulun/article/details/6320502

            BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
            在PreCreateWindow(CREATESTRUCT& cs)中,添加如下語(yǔ)句:
            cs.style &= ~FWS_ADDTOTITLE;
            //* 查了下MSDN它是設(shè)定框架窗口的標(biāo)題。上那句,則是去除掉該樣式屬性。
            //* 然后可以主框架的
            int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
            事件中添加如下設(shè)置標(biāo)題的語(yǔ)句:
            this->SetWindowText(_T("This is an application title."));
            posted @ 2011-09-30 10:15 Jacc.Kim 閱讀(732) | 評(píng)論 (0)編輯 收藏

                  c++本來(lái)就已經(jīng)夠讓人頭痛了,沒(méi)想到學(xué)了c++"還沒(méi)辦法"用于項(xiàng)目開(kāi)發(fā)。因?yàn)檫€需要熟悉開(kāi)發(fā)環(huán)境。在此,簡(jiǎn)要記錄下初次探索MFC架構(gòu)的一點(diǎn)心得體會(huì)。

                  要想利用vs開(kāi)發(fā)項(xiàng)目,我們必需要了解MFC的架構(gòu)以及它們間的相互依賴關(guān)系。
                  1) 應(yīng)用程序程序?qū)嵗? theApp; 
                  它其實(shí)就是我們所啟動(dòng)的程序?qū)嵗J侨值摹R坏┧尫诺袅耍瑒t整個(gè)程序的生命周期就結(jié)束了。我們可以通過(guò)全局函數(shù)::AfxGetApp();來(lái)取得該實(shí)例。
                  2) MFC程序的主框架: CMainFrm;
                  一個(gè)MFC應(yīng)用程序也只有一個(gè)主框架。它負(fù)責(zé)程序中各視圖以及各種面板的布局展現(xiàn)工作。我們可以在任意位置通過(guò)::AfxGetMainWnd();或::AfxGetApp()->m_pMainWnd;
            來(lái)獲得該主框架對(duì)象。
                  3) 文檔模型: CDocTemplate;
                  正常來(lái)說(shuō),文檔模型的職責(zé):負(fù)責(zé)維護(hù)程序中所創(chuàng)建的文檔實(shí)例。(它同主框架一樣,由應(yīng)用程序theApp維護(hù))。
                  在應(yīng)用程序中,我們可以通過(guò) GetFirstDocTemplatePosition();取得第一個(gè)文檔模型對(duì)象的地址(返回值為:POSITION類型).可以通過(guò)GetNextDocTemplate();取得下一個(gè)。從而
            進(jìn)行遍歷。
                  而在文檔中,我們可以通過(guò)GetDocTemplate();來(lái)取得其所屬的文檔模型對(duì)象。
                  4) 文檔:CDocument:
                  其是負(fù)責(zé)數(shù)據(jù)維護(hù)的工作。其通過(guò)結(jié)合相應(yīng)的視圖,可將數(shù)據(jù)展現(xiàn)。一個(gè)文檔可以維護(hù)多個(gè)視圖。(注意:一個(gè)視圖只能屬于一個(gè)文檔)。
                  在主框架對(duì)象中,我們可以通過(guò):GetActiveDocument();取得當(dāng)前活動(dòng)的文檔對(duì)象
                  在文檔模型對(duì)象中,我們通過(guò):GetfirstDocPosition();與GetNextDoc();遍歷文檔對(duì)象
                  在文檔視圖對(duì)象中,我們通過(guò):GetDocument();取得所屬的文檔對(duì)象
                  5) 視圖:CView:
                  與文檔配置,實(shí)現(xiàn)數(shù)據(jù)的界面展現(xiàn)。
                  在主框架類中,我們通過(guò):GetActiveView();獲得當(dāng)前活動(dòng)視圖
                  在文檔類中,可以通過(guò):GetFirstViewPosition();與GetNextView();遍歷出所有的視圖。
            posted @ 2011-09-29 18:46 Jacc.Kim 閱讀(465) | 評(píng)論 (0)編輯 收藏

            本文轉(zhuǎn)自:http://blog.csdn.net/dzyssssss/article/details/6609086

            近日給其他組同事開(kāi)發(fā)了一個(gè)控件,使用vs2008作為開(kāi)發(fā)工具,完成后別人注冊(cè)時(shí)居然不成功,經(jīng)查發(fā)現(xiàn)居然是依賴庫(kù)不全問(wèn)題。

            1、ATL庫(kù)

            2、msvcr90.dll庫(kù)

            對(duì)于第一個(gè)問(wèn)題直接在工程中設(shè)置靜態(tài)鏈接atl庫(kù)即可解決該問(wèn)題,但是對(duì)于第二個(gè)沒(méi)有想明白怎么弄,難道非得發(fā)布msvcr90.dll文件嗎,太麻煩了。后來(lái)一查居然有人說(shuō)是vs2008的bug,不知道是不是,不過(guò)之總解決了上面依賴的庫(kù),不用帶那么多"尾巴"了,呵呵。

            具體處理過(guò)程如下:

            1、在Project\Properties\Configuration Properties\Project Defaults\Use of MFC中,選擇Use MFC in a Static Library

            2、編譯,編譯不通過(guò)沒(méi)關(guān)系(但是我做的庫(kù)是編譯通過(guò)了)

            3、在Project\Properties\Configuration Properties\Project Defaults\Use of MFC中,選擇Use Standard Windows Libraries(就是把設(shè)置改回去)

            4、再次編譯


            再使用dependency工具查看,果然不依賴于上面提到的msvcr90.dll了,但是問(wèn)題是再選擇回去后,編譯出來(lái)的庫(kù)確實(shí)比以前大了不少,具體內(nèi)部原因多半還得問(wèn)微軟是怎么回事了!

            posted @ 2011-09-07 10:26 Jacc.Kim 閱讀(2220) | 評(píng)論 (2)編輯 收藏

             1 BOOL CC3EngineDemoApp::InitInstance()
             2 {
             3         
             4 
             5     CC3EngineDemoDlg* pDlg;
             6     pDlg = new CC3EngineDemoDlg();
             7     pDlg->Create(IDD_C3ENGINEDEMO_DIALOG, NULL);
             8     pDlg->ModifyStyle(WS_MAXIMIZEBOX, 00);
             9     RECT rect;
            10     UINT unDefWidth = 1024;
            11     UINT unDefHeight = 768;
            12     if (this->CalPositionInfo(rect, unDefWidth, unDefHeight))
            13         pDlg->MoveWindow(rect.left, rect.top, unDefWidth, unDefHeight, TRUE);
            14     else
            15         pDlg->MoveWindow(001024768, TRUE);
            16     pDlg->UpdateWindow();
            17     m_pMainWnd = pDlg;
            18     return TRUE;
            19 }
            20 
            21 BOOL CC3EngineDemoApp::OnIdle(LONG lCount)
            22 {
            23     // TODO: Add your specialized code here and/or call the base class
            24 
            25     //return CWinAppEx::OnIdle(lCount);
            26     return TRUE;
            27 }
            posted @ 2011-08-16 16:01 Jacc.Kim 閱讀(475) | 評(píng)論 (0)編輯 收藏

             

             1 bool GetScreenSize(UINT& unWidth, UINT& unHeight)
             2 {
             3     try
             4     {
             5         unWidth = ::GetSystemMetrics(SM_CXSCREEN);
             6         unHeight = ::GetSystemMetrics(SM_CYSCREEN);
             7         return true;
             8     }
             9     catch()
            10     {
            11         unWidth = 0;
            12         unHeight = 0;
            13         return false;
            14     }
            15 }

             

            posted @ 2011-08-16 15:58 Jacc.Kim 閱讀(852) | 評(píng)論 (0)編輯 收藏

            List容器用法操作實(shí)例


            // Test_20110513_1756.cpp : Defines the entry point for the console application.
            //

            //////////////////////////////////////////////////////////////////////////
            //* list容器測(cè)試
            //////////////////////////////////////////////////////////////////////////

            #include 
            "stdafx.h"

            #include 
            <list>
            #include 
            <iostream>
            using namespace std;

            typedef list
            <int> LISTINT;

            int _tmain(int argc, _TCHAR* argv[])
            {
                
            //創(chuàng)建一個(gè)list容器
                LISTINT lInt;

                
            //在list容器的末尾,添加元素
                cout << "------------------------------------------------" << endl << "操作:從后面添加元素" << endl;
                
            for (LISTINT::value_type iValCount = 1; iValCount != 11; iValCount++)
                    lInt.push_back(iValCount);
                
            for (LISTINT::iterator iter = lInt.begin(); iter != lInt.end(); iter++)
                    cout 
            << *iter << endl;

                
            //在list容器的頭部,添加元素
                cout << "------------------------------------------------" << endl << "操作:從前面添加元素" << endl;
                
            for (LISTINT::value_type iValCount = 11; iValCount != 21; iValCount++)
                    lInt.push_front(iValCount);
                
            for (LISTINT::iterator iter = lInt.begin(); iter != lInt.end(); iter++)
                    cout 
            << *iter << endl;

                
            //取出最后一個(gè)元素
                cout << "------------------------------------------------" << endl << "操作:取出最后一個(gè)元素" << endl;
                cout 
            << lInt.back() << endl;

                
            //取出最前一個(gè)元素
                cout << "------------------------------------------------" << endl << "操作:取出最前一個(gè)元素" << endl;
                cout 
            << lInt.front() << endl;

                
            //從后向前顯示list中的元素(注意:迭代器,不可以同名,雖然在不同的作用域下)
                cout << "------------------------------------------------" << endl << "操作:從后向向前顯示list中的元素" << endl;
                
            for (LISTINT::reverse_iterator iter2 = lInt.rbegin(); iter2 != lInt.rend(); iter2++)
                    cout 
            << *iter2 << endl;

                
            //刪除一個(gè)元素
                cout << "------------------------------------------------" << endl << "操作:刪除最后一個(gè)元素" << endl;
                
            if (lInt.size() > 0)
                {
                    LISTINT::iterator delIter 
            = lInt.end();
                    delIter
            --;
                    cout 
            << *delIter << endl;
                    lInt.erase(delIter);
                    
            if (lInt.size() > 0)
                    {
                        delIter 
            = lInt.end();
                        delIter
            --;
                        cout 
            << *delIter << endl;
                    }
                }

                
            //清空元素(并輸入所有元素內(nèi)容----正常輸出為空。因?yàn)楸磺蹇樟?
                cout << "------------------------------------------------" << endl << "操作:清空所有元素(并輸入所有元素內(nèi)容----正常輸出為空。因?yàn)楸磺蹇樟?" << endl;
                lInt.clear();
                
            for (LISTINT::iterator iter3 = lInt.begin(); iter3 != lInt.end(); iter3++)
                cout 
            << *iter3 << endl;

                
            //所有操作均已經(jīng)結(jié)束
                cout << "------------------------------------------------" << endl << "操作:所有操作均已經(jīng)結(jié)束" << endl;
                cout 
            << "------------------------------------------------" << endl;

                
            return 0;
            }

            posted @ 2011-07-04 20:30 Jacc.Kim 閱讀(9610) | 評(píng)論 (2)編輯 收藏

            C++ Map 容器操作實(shí)例

            // Test_20110514_1853.cpp : Defines the entry point for the console application.
            //

            //說(shuō)明:最下面有總結(jié)說(shuō)明。

            #include 
            "stdafx.h"

            #include 
            <iostream>
            #include 
            <map>
            using namespace std;

            typedef map
            <intstring> TMyMap;

            void PrintSplitterString(short sCount = 50)
            {
                
            if (sCount < 20 || sCount > 80)
                    sCount 
            = 50;
                
            for (short i = 1; i <= sCount; i++)
                    cout 
            << "-";
                cout 
            << endl;
            }

            void CoutMapList(const TMyMap& mmMap)
            {
                
            for (TMyMap::const_iterator iter = mmMap.begin(); iter != mmMap.end(); iter++)
                {
                    
            string str = iter->second;
                    cout 
            << "鍵:" << iter->first << "      值:" << str.c_str() << endl;
                }
            }

            int _tmain(int argc, _TCHAR* argv[])
            {
            //*****************************************************************************************
            // * 在此介紹map容器的用法
            //*****************************************************************************************

                
            //1.創(chuàng)建一個(gè)map容器變量
                TMyMap enumMap;

                
            //往map中加入元素
                PrintSplitterString();
                cout 
            << "操作:往map 中添加元素方法一" << endl;
                enumMap[
            1= "One";
                enumMap[
            2= "Two";
                enumMap[
            2= "Seven";    //此時(shí)將是修改鍵為的值,如果該鍵元素不存在,則新建一個(gè)
                CoutMapList(enumMap);

                
            //////////////////////////////////////////////////////////////////////////
                //* 說(shuō)明:使用此方法的優(yōu)點(diǎn)是:十分的方便。
                
            //* 缺點(diǎn):效果不高。因?yàn)閙ap 類已經(jīng)對(duì)[] 操作符進(jìn)行了重載
                
            //*          比如,在插入第個(gè)元素時(shí),系統(tǒng)需要先在enumMap中查找主鍵為的項(xiàng),沒(méi)有發(fā)現(xiàn),然后新的對(duì)象插入enumMap,鍵是
                
            //*       1,值是一個(gè)空的字符串。插入完成后,再將將顯式的Two字符串,賦給值。如果我們要插入的是一個(gè)類對(duì)象了?
                
            //*       那將會(huì)是個(gè)很大的開(kāi)銷。
                
            //*       缺點(diǎn):如果先前已經(jīng)存在了鍵為的元素時(shí),則將變成值修改
                //////////////////////////////////////////////////////////////////////////

                cout 
            << endl << "操作:往map 中添加元素方法二" << endl;
                enumMap.insert(TMyMap::value_type(
            2"Third"));
                
            //////////////////////////////////////////////////////////////////////////
                //* 說(shuō)明:此方法解決了上面方法的缺點(diǎn),但有個(gè)地方需要注意:
                
            //* 如果列表中已經(jīng)存在鍵為的元素時(shí),它是不會(huì)插入新的元素的。
                //////////////////////////////////////////////////////////////////////////
                enumMap.insert(TMyMap::value_type(3"Third"));
                CoutMapList(enumMap);
                PrintSplitterString();

                
            //查找并獲取map中的元素
                PrintSplitterString();
                cout 
            << "操作:查找并獲取map 中元素" << endl;
                
            //方法一:通過(guò)下標(biāo)獲得一個(gè)值(此適用在下標(biāo)明確的情況下)
                string tmp = enumMap[4];    //此方法總是安全的。就算不存在鍵為的元素,系統(tǒng)也不會(huì)報(bào),只是返回的值是空的。因?yàn)橄到y(tǒng)是會(huì)新創(chuàng)建一個(gè)鍵為的節(jié)點(diǎn),(值當(dāng)然為空)
                cout << tmp.c_str() << endl;
                
                
            //另一種取得元素的方法是,通過(guò)查找
                TMyMap::const_iterator iter_find = enumMap.find(2);
                
            if (iter_find != enumMap.end())
                {
                    
            //找到了
                    cout << iter_find->second.c_str() << endl;
                }
                
            else
                {
                    
            //沒(méi)有找到
                    cout << "沒(méi)有找到。" << endl;
                }
                PrintSplitterString();

                
            //從map 中刪除元素
                PrintSplitterString();
                cout 
            << "操作:從map 中刪除元素的方法" << endl;
                
            //////////////////////////////////////////////////////////////////////////
                //* 刪除的方法有:
                
            //* iterator erase(iterator it);//通過(guò)一個(gè)條目對(duì)象刪除
                
            //* iterator erase(iterator first, iterator last);//刪除一個(gè)范圍
                
            //* size_type erase(const key& key);//通過(guò)鍵來(lái)刪除
                
            //* clear();//相漕運(yùn)于enumMap.erase(enumMap.begin(), enumMap.end());
                //////////////////////////////////////////////////////////////////////////
                cout << "==> 全部列表如下:" << endl;
                CoutMapList(enumMap);
                enumMap.erase(
            3);
                cout 
            << "==> 刪除掉鍵值為:的" << endl;
                CoutMapList(enumMap);
                cout 
            << endl << endl;
                enumMap.erase(enumMap.begin());
                cout 
            << "==> 刪除掉第一個(gè)元素" << endl;
                CoutMapList(enumMap);
                cout 
            << endl << endl;
                enumMap.clear();
                cout 
            << "==> 全部清空" << endl;
                CoutMapList(enumMap);
                PrintSplitterString();

                
            //所有操作均已經(jīng)結(jié)束
                PrintSplitterString();
                cout 
            << "所有操作均已經(jīng)結(jié)束" << endl;
                PrintSplitterString();
                cout 
            << endl;


            //*********************************************************************************************
            //* 現(xiàn)在總結(jié)如下:
            //* 對(duì)于map的操作。最好不要通過(guò)下標(biāo)進(jìn)行。比如:想要取一個(gè)元素,要先通過(guò)查找,有了,再操作,沒(méi)有。不操作。
            //* 否則有可能系統(tǒng)會(huì)為你自動(dòng)添加 “莫名奇妙” 的元素進(jìn)去你都不知道
            //*********************************************************************************************

                
            return 0;
            }

            posted @ 2011-07-04 20:30 Jacc.Kim 閱讀(2457) | 評(píng)論 (0)編輯 收藏

            以下是Vector容器用戶總結(jié)

            ---------------------------------------------------------------------------------------------------
            幾個(gè)介紹vector容器還不錯(cuò)的文章鏈接:
                http:
            //blog.csdn.net/fm0517/archive/2009/06/09/4254099.aspx

            ---------------------------------------------------------------------------------------------------

            // Test_20110513_1036.cpp : Defines the entry point for the console application.
            //

            #include 
            "stdafx.h"

            #include 
            <vector>
            #include 
            <iostream>
            using namespace std;

            int _tmain(int argc, _TCHAR* argv[])
            {
                
            //創(chuàng)建vector容器
                vector<int> vInt;
                
            //也可以下面這樣初始化,表示將所有的元素初始化為
                
            //vector<int> vInt(0);
                
            //添加元素
                for (vector<int>::value_type i = 0; i < 10; i++)
                    vInt.push_back(i 
            + 1);
                
            //輸出元素
                cout << "-------------------------------------------------------" << endl << "操作:添加元素" << endl;
                
            for (vector<int>::iterator iter = vInt.begin(); iter != vInt.end(); iter++)
                    cout 
            << *iter << endl;
                
                
            //erase操作----其實(shí)就是刪除指定的某個(gè)元素
                cout << "-------------------------------------------------------" << endl << "操作:erase操作" << endl;
                
            for (vector<int>::iterator iter3 = vInt.begin(); iter3 != vInt.end(); iter3++)
                {
                    
            if (*iter3 == 8)
                    {
                        iter3 
            = vInt.erase(iter3);
                        
            break;
                    }
                }
                
            for (vector<int>::iterator iter4 = vInt.begin(); iter4 != vInt.end(); iter4++)
                    cout 
            << *iter4 << endl;

                
            //刪除最后一個(gè)元素,方法一
                cout << "-------------------------------------------------------" << endl << "操作:刪除最后一個(gè)元素之方法一" << endl;
                
            if (vInt.size() > 0)
                {
                    vector
            <int>::iterator iterEnd = vInt.end() - 1;
                    
            /*iterEnd = */vInt.erase(iterEnd);
                    
            //輸出
                    for (vector<int>::iterator iter5 = vInt.begin(); iter5 != vInt.end(); iter5++)
                        cout 
            << *iter5 << endl;
                }

                
            //刪除最后一個(gè)元素,方法二
                cout << "-------------------------------------------------------" << endl << "操作:刪除最后一個(gè)元素之方法二" << endl;
                
            if (vInt.size() > 0)
                {
                    vector
            <int>::iterator iterEnd2 = vInt.end() - 1;
                    vInt.pop_back();
                    
            //輸出
                    for (vector<int>::iterator iter5 = vInt.begin(); iter5 != vInt.end(); iter5++)
                        cout 
            << *iter5 << endl;
                }

                
            //清空所有數(shù)據(jù)元素
                vInt.clear();
                
            //輸入元素
                cout << "-------------------------------------------------------" << endl << "操作:清空元素" << endl;
                
            for (vector<int>::iterator iter2 = vInt.begin(); iter2 != vInt.end(); iter2++)
                    cout 
            << *iter2 << endl;

                
            return 0;
            }



            以下是執(zhí)行結(jié)果:
                 

            posted @ 2011-07-04 20:29 Jacc.Kim 閱讀(517) | 評(píng)論 (0)編輯 收藏

            在C++的類的成員函數(shù)中,允許直接訪問(wèn)該類的成員對(duì)象的私有成員變量
            // SmartPointerStu.cpp : Defines the entry point for the console application.
            //

            #include 
            "stdafx.h"

            //#include "SmartPointer.h"
            //#include <iostream>
            //using namespace std;

            class CPointEx_
            {
            public:
                
            //CPointEx_(int _x = 0, int _y = -1) : x(_x), y(_y) {}
                void SetValue(int x, int y) { this->= x, this->= y; }
                
            void CallPrivateMem(const CPointEx_& AObj)
                {
                    x 
            = AObj.x;
                    y 
            = AObj.y;
                }
            private:
                
            int x;
                
            int y;
            };

            int _tmain(int argc, _TCHAR* argv[])
            {
                CPointEx_ theObj, theObj2;
                theObj.SetValue(
            1020);
                theObj2.SetValue(
            3040);
                theObj2.CallPrivateMem(theObj);


                system(
            "pause");
                
            return 0;
            }


            posted @ 2011-06-29 14:41 Jacc.Kim 閱讀(1472) | 評(píng)論 (0)編輯 收藏

            僅列出標(biāo)題
            共14頁(yè): First 6 7 8 9 10 11 12 13 14 
            久久人人爽人人爽人人片AV高清| 久久精品国产清高在天天线| 久久精品无码专区免费| 日本加勒比久久精品| 伊人久久大香线蕉亚洲| 国产一区二区三区久久| 亚洲一级Av无码毛片久久精品| 99蜜桃臀久久久欧美精品网站| 久久er热视频在这里精品| 亚洲精品久久久www| 9191精品国产免费久久 | 精品久久久久久久久中文字幕| 久久九九亚洲精品| 亚洲中文字幕无码久久2017| 99久久国产亚洲高清观看2024| 日产精品久久久久久久| 久久久久久亚洲精品无码| 日本三级久久网| 久久99国产精品尤物| 国产精品一区二区久久精品涩爱| 国产成人久久久精品二区三区| 久久综合香蕉国产蜜臀AV| 欧美国产成人久久精品| 伊人久久大香线蕉成人| 久久夜色精品国产www| 国产成人精品久久综合| 大美女久久久久久j久久| AV色综合久久天堂AV色综合在| 狠狠精品久久久无码中文字幕| 欧洲性大片xxxxx久久久| 精品久久人人妻人人做精品 | 九九久久自然熟的香蕉图片| 亚洲va中文字幕无码久久不卡 | 国产L精品国产亚洲区久久| 国产精品美女久久久m| 久久精品亚洲一区二区三区浴池| 狠狠色狠狠色综合久久| 久久久一本精品99久久精品66 | 久久综合亚洲色一区二区三区| 久久免费视频6| 无码伊人66久久大杳蕉网站谷歌|