Time of Update: 2018-12-06
今天在閱讀C++ primer時遇到如下一段代碼:istream_iterator<int> in_iter(cin);//read ints from cinistream_iterator<int> eof;//istream "end" iterator//read until end of file,storing what read in vecwhile(in_iter != eof){ //increament advances the stream
Time of Update: 2018-12-06
看看下面程式有什麼錯誤:#include <iostream>using namespace std;class Father{public: Father(){}; ~Father(){};};class Son:public Father{public: Son(){}; ~Son(){};};int main(){ Father *pfather=new Son; delete pfather; pfather=NULL;
Time of Update: 2018-12-06
歡迎進入我的部落格網站http://www.8timer.com 沒想到寫了兩篇關於仿QQ的介面的文章才兩幾天,關注的人還真不少,看來大家對QQ還真是情有獨衷啊!呵呵! 首先,我並沒有太多的時間花在這上面,也只有每天下班後,有空就研究研究.好了,廢話不說.首先還是貼幾張這幾天研究的成果的.等程式完功,再貼代碼.如果你有興趣,請繼續關注我的部落格吧!圖:左邊為用C#做的QQ 右邊為真實版QQ
Time of Update: 2018-12-06
當初因為要用到這種功能的工具,便從網上找了C# 重新命名檔案的方法,便自己做了一個。雖然簡單,但挺實用的,我經常能用到 就一個檔案代碼:代碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System;using System.Collections.Generic;using System.ComponentModel;using
Time of Update: 2018-12-06
暫時還沒時間,把代碼分離出來,做到通用,所以大家看著自己動手改改代碼吧看圖:QQ的 美化方法:使用 Renderer 屬性和 ToolStripRenderer 類來自訂 ToolStrip
Time of Update: 2018-12-06
呃,弄了好久的QQ皮膚、介面,但一直沒有太多時間和精力來弄通訊部份,不免有些遺憾。當然一個軟體如果要想做好、人性化那是要花相當的技術精力的。 最近離職,在家休息了一段時間,完善一下通訊部份,雖然漏洞很多,但免強完成了山寨QQ,呵呵! 程式做得不好,暫不提供源碼下載,只提供測試程式,相關控制項內容會陸續發出來,大家有時間可以相互交流 NET技術交流1群:57218890(已滿) NET技術交流2群:57219423 NET技術交流3群:112546812 軟體簡介:
Time of Update: 2018-12-06
上周實習做FcitxIME時碰到一個字元數組的問題,因基礎的不紮實,導致經調試了幾分鐘才發現問題所在。 字元數組初始化常見有兩種格式:char arr_test[10] = { 'h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'}; 和char arr_test[11] = "helloworld"; 為什麼是一樣的內容,兩個數組的長度不一樣,一個是10,一個是11,因為預設在第二個數組後面加上了字串結束符'\
Time of Update: 2018-12-06
這篇文章是CSDN C++論壇中多次討論到的一個問題。先看下面程式:#include <iostream>using namespace std;#include <string>int main(){ int *p=new int[5]; //delete p; delete []p; p=NULL; //string *p=new string[5];//delete p;//delete []p;//p=NULL; return
Time of Update: 2018-12-06
今天討論下我在C++過程中遇到一個關於sizeof和strlen區別的問題。 在Window編程中有如下一段程式: case WM_PAINT:{ HDC hDc; PAINTSTRUCT ps; hDc=BeginPaint(hwnd,&ps); //BeginPaint只能在WM_PAINT下使用 TextOut(hDc,0,0,"my program",strlen("my program"));
Time of Update: 2018-12-06
繼承和派生:(1)子類不加修改的延續父類的特徵,我們把它叫做繼承。(2)在原有基礎上建立新類並且添加新新征的過程叫做“類的派生”。(3)把原有的類叫做“基類”,又叫“父類”,把建立的類叫做“衍生類別”,又叫子類。 例如:class Son : public Father(4)公有派生的公有成員仍然為公有成員;公有派生的保護成員仍然為保護成員;公有派生的私人成員是不能為派生訪問的。(5)私人繼承:class Son : private Father 私人方式派生的子類,
Time of Update: 2018-12-06
首先看下面程式:#include <iostream>using namespace std;int main(){ int a[5]={0,1,2,3,4}; cout<<a<<endl; cout<<&a<<endl; cout<<a+1<<endl; cout<<&a+1<<endl; return
Time of Update: 2018-12-06
代理類的引入 為什麼需要代理,自然是用戶端與伺服器端不能正常溝通,需要第三方來進行溝通,這第三方自然成了代理,準確來說,應該是伺服器端的代理,用來實現的代理功能的類就叫代理類。 那麼什麼時候用戶端與伺服器端不能正常溝通呢?《C++沉思錄》有言:C++容器通常只能包含一種類型的對象。那麼我們怎樣才能設計一個C++容器,使它有能力包含類型不同而彼此相關的對象呢?首先想到的是容器裡儲存的是不是對象本身,而是指向對象的指標。這雖然看起來好像解決了問題,但存在兩個缺點:一是儲存的是指向對象的指標,不是
Time of Update: 2018-12-06
原文:http://blog.csdn.net/liam1122/article/details/1966617為了便於說明我們以String類為例:首先定義String類,而並不實現其成員函數。Class String{public: String(const char *ch=NULL);//預設建構函式 String(const String &str);//拷貝建構函式 ~String(void); String &operator=(const
Time of Update: 2018-12-06
這篇文章整理自CSDN論壇,希望面試不再重現這樣的題目。經常可以在一些討論群組裡看到下面的提問:“誰知道下面C語句給n賦什麼值?” m = 1; n = m+++m++; 程式如下:#include <iostream>using namespace std;int main(){ int m = 1; int n = m+++m++;
Time of Update: 2018-12-06
定義和聲明區別:(1)定義分配記憶體,聲明沒有(2)定義只能出現一次,而聲明可以出現多次(3)extern char a[] 與extern char a[100]等價,因為這裡只是聲明,不分配空間(4)extern int a extern
Time of Update: 2018-12-06
重載函數(1)定義:將一組功能非常相近的函數定義為重載函數。(2)一組重載函數是以參數類型或參數個數加以區別的,只有傳回值不同不是一組重載函數,將會產生編譯錯誤。(3)編譯器調用重載函數的規#include <stdio.h>void ShowMessage(const char* Text,int Type);void ShowMessage(const char* Text,unsigned int Type);int main(){ unsigned char i=0;
Time of Update: 2018-12-06
這是實習工作中遇到的一個問題,其實不能算是一個問題,只能算一個注意點吧。 看程式:unsigned char* read_file(int fd){ unsigned char buffer[256]; memset(buffer, '\0', sizeof(buffer)); read(fd, buffer, sizeof(buffer)); return buffer;} 上面程式是有問題的,unsigned char
Time of Update: 2018-12-06
這是CSDN上一個我覺得對C++初學者瞭解虛函數一處很好的題目。#include <iostream>using namespace std;class CA{public:void f(){cout << "CA f()" << endl;}virtual void ff(){cout << "CA ff()" << endl;f();}};class CB : public CA{public :virtual void
Time of Update: 2018-12-06
C/C++記憶體儲存問題是筆試中必須掌握的。先看下面的程式:#include <stdio.h>#include "string.h"#include "malloc.h"void Swap(int a,int b){int temp; temp=a; a=b; b=temp;}int Get_Int(int a){int i=1+a;return i;}char* Get_Memory0(){char* p=(char*)malloc(sizeof(
Time of Update: 2018-12-06
題:main主函數執行完畢後,是是否可能會再執行一段代碼?給出說明。答:如果需要加入一段在main退出後執行的代碼,可以使用atexit()函數註冊一個函數,代碼如下:#include <stdio.h>#include <stdlib.h>int atexit(void(*function)(void));void fn1(void),fn2(void),fn3(void),fn4(void);int main(){ atexit(fn1); atexit(