Time of Update: 2015-06-26
標籤:斷行符號 重複上一次命令產生可調試的可執行檔:gcc -g main.c -o main, 必須加上-g選線, 表示在可執行檔中加入源檔案資訊, 但並不是將源檔案嵌入可執行檔, 所以在調試時必須保證gdb能夠找到源檔案進入調試:gdb fname, 進入fname可執行檔的調試環境查看源檔案代碼:l/list n/func/fname:n/fname:func查看詳細資料:i/info 查看一個斷點|變數等的詳細資料調試步驟:start 開始時使用, 開始運行程式,
Time of Update: 2015-06-26
標籤:單鏈表 c++ 下列代碼實現的是單鏈表的按序插入、鏈表元素的刪除、鏈表的輸出// mylink.h 代碼#ifndef MYLINK_H#define MYLINK_H#include<iostream>using namespace std;struct node{ int data; node *next;};class list{public: list() {
Time of Update: 2015-06-26
標籤:轉自:http://linhs.blog.51cto.com/370259/140927 C++調用C的庫函數時,如果標頭檔定義得不恰當,可能會出現明明某函數在obj檔案中存在,但是卻發生連結失敗的情況,出現如下錯誤: undefined reference to ‘xxx‘
Time of Update: 2015-06-26
標籤:http://blog.csdn.net/qll125596718/article/details/6901935#include <iostream>#include <stdint.h>#include <bitset>using namespace std;int main() { for(uint64_t i=0; i<64;
Time of Update: 2015-06-26
標籤:c++錯誤認知沒有任何建構函式的時候, 編譯器總會產生預設建構函式 編譯器僅在必要的時候產生預設建構函式 解構函式同理條件 : 有帶有預設建構函式的member有帶有預設建構函式的base class有virtual function有virtual inherit任何對象都帶有vptr / 可以對任何對象指標進行 dynamic_cast 操作 只有對象具有 多態 屬性的時候 , 才具有 vptr , 才可以對其指標進行 dynamic_cast .對一個沒有多態
Time of Update: 2015-06-26
標籤:c++ class iostream namespace 類 Description小平幫老師處理期末成績時遇到了問題。他需要計算每個同學的平均成績,並判斷他們是否通過了期末考試不及格成績(<60),若都通過才能pass,若沒通過要說明是哪幾科未通過。因此他需要兩個函數,一個求平均成績(不考慮小數),另
Time of Update: 2015-06-26
標籤://從今天起準備認真看完這本書。本渣雖然笨,但是窩懶啊。。。。//今天開始看第一章。希望堅持下去。 第一章 引言通過討論連通問題的幾種演算法,來引出演算法的重要性。 1.1 連通問題的快速尋找演算法感覺就是把每個點染色,每個顏色代表一堆,互相連通。每次輸入兩個點,把兩個點所屬那個顏色改為相同,這樣他們代表就都互相連通。時間複雜度:O(MN), M是輸入指令次數,N是點個數//1.1 連通問題的快速尋找演算法#include <stdio.h>
Time of Update: 2015-06-26
標籤:LeetCode第一題,剛拿到題目時雖然明知道n方的遍曆演算法會逾時,但還是不信邪的提交了一次,然而編程不存在運氣,TLE不可避免。但是之後的思維方式比較直接,我並沒有立刻想到O(n)的方法,想了一種先對數組進行排序,利用目標數和待選擇的數的關係來減小搜尋範圍:1.不存在負數:那麼比目標數大的數不必搜尋2.存在負數:搜尋負數和比目標大的數,或者搜尋正數比目標小的數;這種情況還存在全為負數,只能按照最差的n方方式搜尋。按照這個最佳化思路,雖然演算法嚴格意義上來說是n方複雜度的,但是實際效能並
Time of Update: 2015-06-26
標籤:shared unique c++ 引用 just read it smart_ptr: https://mbevin.wordpress.com/2012/11/18/smart-pointers/使用任何指標是都要考慮ownership+memory-management+lifetime這幾個問題。 who is the owner of this
Time of Update: 2015-06-26
標籤: 將成員變數聲明為private本節條款,作者花了很大的篇幅去介紹,可是我感覺就學到一句話。 那就是注意程式的封裝性。 程式的封裝性起到什麼作用?很明顯是保護資料操作的安全性以及增強以後程式的可維護性。將類的資料成員聲明為private的,可以保護資料不被隨便修改。大家都明白許可權等級就是安全等級。至於程式的可維護性,就是用良好的函數介面代替直接的資料成員的操作,這樣不但編寫的時候方便,而且在修改程式計算過程的時候,只需要修改函數介面內部程式,而且不需要全部重新編譯。
Time of Update: 2015-06-26
標籤:學習C++ -> 建構函式與解構函式 一、建構函式的介紹 1. 建構函式的作用 建構函式主要用來在建立對象時完成對對象屬性的一些初始化等操作, 當建立對象時, 對象會自動調用它的建構函式。一般來說, 建構函式有以下三個方面的作用: ■
Time of Update: 2015-06-26
標籤:C. Propagating treeTime Limit: 20 SecMemory Limit: 256 MB題目串連http://codeforces.com/contest/383/problem/CDescriptionIahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes
Time of Update: 2015-06-26
標籤:Member function templates CANNOT be virtual! On the contrary odinary member function templates can be virtual.Linkage of Templates1 // default2 extern "C++" tempalte<typename T> void normal();3 4 // no - templates cannot have C linkage5
Time of Update: 2015-06-26
標籤:必須返回對象時,別妄想返回其reference我們上節分析了對象引用傳遞的好處,現在說明函數返回引用對象帶來的種種壞處。 先來一段代碼:class Rational{public: Rational(int numerator=0, int denominator=1); ……private: int n, d; friend const Rational operator*(const Rational& lhs,
Time of Update: 2015-06-26
標籤:原文:C#中char[]與string之間的轉換string 轉換成 Char[] string ss = "abcdefg"; char[] cc = ss.ToCharArray();Char[] 轉換成string string s = new string(cc);此外,byte[] 與 string 之間的裝換 byte[] bb = Encoding.UTF8.GetBytes(ss); string s =
Time of Update: 2015-06-26
標籤:using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using Sy
Time of Update: 2015-06-26
標籤:首先,把要擷取的變數許可權定義為public類型變數。方法一.public GameObject 另一個物體; //監視面板拖拽賦值另一個物體.GetComponent<指令碼>().變數
Time of Update: 2015-06-26
標籤:cxf c# webservice java調用c#的webservice,現在已經測試通過,而且用到了項目中。現在把實現方式和遇到的問題分享給大家。具體源碼如下: JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); String url =
Time of Update: 2015-06-26
標籤:1、建立windows表單,項目-->添加新項-->Visual C#項-->Windows
Time of Update: 2015-06-26
標籤:c. kyoya and colored codeforces round #30 組合 數論 C. Kyoya and Colored BallsKyoya Ootori has a bag with n colored balls that are colored with k different colors.