Time of Update: 2015-05-20
標籤:c++最近要用MFC開發一個介面,裡面有一個需求就是產生一個與可執行檔(exe檔案)同名的檔案夾,比如我的可執行檔路徑是D:\KFS\codes\22222\Release\22222.exe,我需要在D:\KFS\codes\22222\Release路徑下產生一個22222的檔案夾放東西。查閱了一點資料之後,成功了。之後寫了一個小demo。下面上代碼:#include
Time of Update: 2015-05-20
標籤:c++ c++11 在C++11中,使用花括弧來初始設定變數得到全面的應用,也可以用花括弧來對變數賦值。當用於內建類型變數時,這種初始化的一個重要特點是如果使用列表初始化且初始值存在丟失資訊的風險,編譯器將報錯。int _tmain(int argc, _TCHAR* argv[]){long double ld = 3.1415926536;int a{ ld };int b
Time of Update: 2015-05-20
標籤:c語言 strtok函數 null 一、strtok( )函數strtok( )函數包含於標頭檔string.h文法:char *strtok( char *str1, const char *str2 ); 功能:函數返回字串str1中緊接“標記”的部分的指標,
Time of Update: 2015-05-20
標籤:// 實現對一個8bit資料(unsigned char 類型)的指定位(例如第n位)置0或者置1操作,並保持其他位不變#include <stdio.h>void bit_set(unsigned char *p_data, unsigned char position, int flag){unsigned c;unsigned char a = 1;a = a << (position - 1);if (flag == 1){*p_data =
Time of Update: 2015-05-20
標籤:指標 c++ C++11使用nullptr關鍵字,是表達更準確,型別安全的null 指標指向常量的指標不能通過指向常量的指標改變所指對象的值,但指標本身可以改變,可以指向另外的對象。例int a;const int *p1 = &a; //p1是指向常量的指標int b;p1 = &b; //正確,p1本身的值可以改變*p1 = 1;
Time of Update: 2015-05-20
標籤:c++指標空值nullptr以往用0或者NULL去表達null 指標的問題:C/C++的NULL宏是個被有很多潛在BUG的宏。因為有的庫把其定義成整數0,有的定義成 (void*)0。在C的時代還好。但是在C++的時代,這就會引發很多問題。C++11使用nullptr關鍵字,是表達更準確,型別安全的null 指標#include <iostream>using namespace std;int main() {//
Time of Update: 2015-05-20
標籤:問題描述:(1)閱讀程式,寫出執行結果#include <iostream>using namespace std;class A{public: A() { a=0; } A (int i) { a=i; } void print() { cout<<a<<" "; }private: int a;};class B:
Time of Update: 2015-05-20
標籤:問題描述:(2)閱讀程式,寫出執行結果#include <iostream>using namespace std;class A{public: A(char *s) { cout<<s<<endl; }};class B:public A{public: B(char *s1, char *s2):A(s1) { cout<<s2<<endl; }};class
Time of Update: 2015-05-20
標籤:問題描述:(2)閱讀程式,寫出執行結果#include <iostream>using namespace std;class Base{public: Base(char i) { cout<<"Base constructor. --"<<i<<endl; }};class Derived1:virtual public Base{public: Derived1(char i,char
Time of Update: 2015-05-20
標籤:問題描述:(4)閱讀程式,寫出執行結果,並回答問題 #include<iostream> using namespace std; class A { public: int n; }; class B:public A {}; // class B:virtual public A{}; class C:public A {}; // class C:virtual public A{};
Time of Update: 2015-05-20
標籤:問題描述:(5)閱讀下面類的定義,請說出在測試函數中不同情況的調用產生的結果 <span style="font-family:KaiTi_GB2312;font-size:18px;color:#ff6666;"><strong>#include <iostream>using namespace std;class A{protected: int a,b;public: A(int aa,
Time of Update: 2015-05-20
標籤: 1 2 #include <stdio.h> 3 #include <stdlib.h> 4 5 class Parent 6 { 7 public: 8 Parent(){_static = this;} 9 ~Parent(){}10 virtual void print();11 static Parent* _static;12 };13 14 void Parent::print()15 {16 printf("print Parent!\n");1
Time of Update: 2015-05-20
標籤:------Java培訓、Android培訓、iOS培訓、.Net培訓、期待與您交流!
Time of Update: 2015-05-20
標籤:------Java培訓、Android培訓、iOS培訓、.Net培訓、期待與您交流!
Time of Update: 2015-05-20
標籤:------Java培訓、Android培訓、iOS培訓、.Net培訓、期待與您交流! -------在程式中,可能需要為某些整數定義一個別名,我們可以利用預先處理指令#define來完成這項工作,您的代碼可能是: #define MON 1#define TUE 2#define WED 3#define THU 4#define
Time of Update: 2015-05-20
標籤:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Threading;
Time of Update: 2015-05-20
標籤:c# 繼承 類 對象 介面
Time of Update: 2015-05-20
標籤:前言:有兩個簡單好用的LINQ擴充方法 ToDictionary() 和ToList(),你可能知道或不知道,但是它的的確確可以簡化查詢轉化為集合的任務:簡介: LINQ和順延強制據你所認識的LINQ,你可能會不知道這些查詢運算式在幕後做了些什麼。 讓我們說說今天我們樣本的目的,我們有一些POCO類(POCO代表傳統CLR對象,指的是一個類,它只有非常少的功能,這一概念源自Java POJO)。1 // just a simple
Time of Update: 2015-05-20
標籤:委託是一種特殊的參考型別,它將方法也作為特殊的對象封裝起來,從而將方法作為變數或參數進行傳遞 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 delegate void DualFunction(double x,double y); 9 class
Time of Update: 2015-05-20
標籤: class Class1 { static void Main(string[] args) { YuanGong yg = new YuanGong(); JingLi jl = new JingLi(); LaoBan lb = new LaoBan(); //聲明一個數組的父類 YuanGong[] ayg = { yg, jl, lb }