Time of Update: 2018-12-03
//=====================================================================//TITLE:// 圖文詳解如何搭建Windows的Android C++開發環境(一)//AUTHOR:// norains//DATE:// Thursday 14-April-2011//Environment:// Cygwin 1.7.9// Android NDK r5//===================
Time of Update: 2018-12-03
#include<iostream>#include<cstring> #include<stack>using namespace std;typedef struct{ int detail[3][3];}Map;int main(){ Map m,n; //利用指標進行struct結構體中數組的賦值操作 for(int i=0;i<9;i++) scanf("%d",*m.detail+i); for(int i=0;i<9;i++
Time of Update: 2018-12-03
#include<iostream>#include<queue>using namespace std;bool test; //bool變數預設的初始值為false typedef struct Node{ int a; friend bool operator<(const Node& a,const Node& b){ //定義struct結構的比較函數 if( a.a< b.a) return
Time of Update: 2018-12-03
#include<iostream>#include<queue>using namespace std;class Node{ private: int a; public: Node(int a){ this->a=a; } //定義class對象的比較函數 friend bool operator<(const Node& a,const Node&
Time of Update: 2018-12-03
#include<pthread.h>#include<stdio.h>#include<stdlib.h>#include<string.h>#include<semaphore.h>#include <unistd.h>#define THREAD_NUM 25typedef struct{ FILE *_fp; int _nThreadId;//第幾個線程 sem_t
Time of Update: 2018-12-03
//*********************************************************************************//第6題//統計每個月過生日的人數,120個人的,隨機產生這些人的生日的月份。//*********************************************************************************#include <stdio.h>#include <stdlib.
Time of Update: 2018-12-03
非C++內建型別 A 和 B,在哪幾種情況下B能隱式轉化為A?答:a. class B : public A { ……} // B公有繼承自A,可以是間接繼承的b. class B { operator A( ); } // B實現了隱式轉化為A的轉化c. class A { A( const B& ); } // A實現了non-explicit的參數為B(可以有其他帶預設值的參數)建構函式d. A& operator= ( const A& ); // 賦值操作,雖不
Time of Update: 2018-12-03
//*********************************************************************//第9題//顯示特殊矩陣//*********************************************************************#include <stdio.h>#include <stdlib.h>#include <math.h>void main(){int array[6
Time of Update: 2018-12-03
string類預設產生的函數有哪些?預設建構函式解構函式拷貝建構函式賦值建構函式 具體實現如下:#include <iostream>using namespace std;class mystring{friend ostream &operator<<(ostream &out,const mystring &s);public:mystring(const char *str=NULL);mystring(const mystring
Time of Update: 2018-12-03
#include <iostream>using namespace std; class B {public:int i, j;B(int x = 999) :j(x),i(j){cout << "B::B() invoked\n" << endl;} ~B(){cout << "B::~B() invoked\n" << endl;}};class D : public B {public:D() {cout <<
Time of Update: 2018-12-03
#include <iostream>#include <string>using namespace std;class Fruit{private:string name;string colour;public:friend istream &operator >> (istream &,Fruit &);friend ostream &operator << (ostream &,const
Time of Update: 2018-12-03
函數 文法 功能 Len Len(string|varname) 返回字串內字元的數目,或是儲存一變數所需的位元組數。 Trim Trim(string) 將字串前後的空格去掉 Ltrim Ltrim(string) 將字串前面的空格去掉 Rtrim Rtrim(string) 將字串後面的空格去掉 Mid Mid(string,start,length) 從string字串的start字元開始取得length長度的字串,如果省略第三個參數表示從start字元開始到字串結尾的字串 Left
Time of Update: 2018-12-03
/// <summary> /// CS下在C#裡調用顯示水晶報表 /// 水晶報表在CrystalReport9中定義,資料來源可以是表、視圖、預存程序(最後一句必須是select語句),可以包含子報表 /// 調用執行個體:LoadReport(this.crystalReportViewer1,"D:\\66.rpt","kys","hrdb","sa","kys"); /// 2004-10-29 writed by 華陽 /// </summary>
Time of Update: 2018-12-03
Java與C/C++有什麼區別(1)Java中對記憶體的分配是動態,它採用物件導向的機制,採用運算子new為每個對象分配記憶體空間,而且,實際記憶體還會隨程式運行情況而改變.程式運行中,每個, Java系統自動對記憶體進行掃描,對長期不用的空間作為”垃圾”進行收集,使得系統資源得到更充分地利用.按照這種機制,程式員不必關注記憶體管理問題,這使Java程式的編寫變得簡單明了,並且避免了了由於記憶體管理方面的差錯而導致系統出問題.而C語言通過malloc()和free()這兩個庫函數來分別實現分配內
Time of Update: 2018-12-03
在使用C++編程的過程當中,常常需要對類成員進行初始化,通常的方法有兩種:第一種方法:CMYClass::CSomeClass(){ x=0; y=1;}第二種方法:CSomeClass::CSomeClass() : x(0), y(1){}本文將要探討這兩種方法的異同以及如何使用這兩種方法。
Time of Update: 2018-12-03
有以下兩個C++類:class Base {public: Base(int a, int b) : m_a(a), m_b(b) {} virtual void Func1(); virtual int Func2();private: int m_a, m_b;}class Derived : public Base {public: Derived(int a, int b, double d) : Base(a, b), m_d(d) {} virtual
Time of Update: 2018-12-03
最近整理原來的博文,資料結構和演算法,筆試題,眼淚嘩嘩的,網申開始。廢話少說,這次實現的單鏈表類://list.h#ifndef _LIST_H_#define _LIST_H_#ifndef NULL#define NULL 0#endif//C++實現單鏈表template<class T>struct node{T data;node<T> *next;node():next(NULL){}node(T
Time of Update: 2018-12-03
最近整理原來的一些代碼,腦子有點不好使,還是記下來吧。//binary_tree.h,遍曆包含了遞迴和非遞迴兩種,層次遍曆#ifndef _BINARY_TREE_H_#define _BINARY_TREE_H_template<class T> struct BiNode{T data;BiNode<T>* lchild, *rchild;};template<class T>class
Time of Update: 2018-12-03
因為我的工作與GPS,相關,實習期間的項目可以會與GPS的協議相關,所以先自己去看了一下 GPS 有很多種協議,如GSA,GGA .......在這裡我不一一列舉 在這裡我用其中的一種來展示一下 怎麼樣進行協議解析,用一個字串截取函數就可以了下面是一個條類比資料 string sTarget = "$GPGGA,134658.00,5106.9792,N,11402.3003,W,2,09,1.0,1048.47,M,-16.27,M,08,AAAA*60";進行解析
Time of Update: 2018-12-03
看著別人的源碼總是會驚訝,原來C語言還可以這麼用!貼出一些我總結的一些小技巧,各位看到的也別吝嗇,把自己知道的貼出來,大家共同進步1.這是我自己發現的技巧,當然肯定有人比我先發現,但這是自己領悟出來的,很有成就感啊我們應該都遇到過大小寫轉換的問題,很簡單是嗎?用位來寫呢?寫著寫著我居然發現這樣一件事~ch ^=