Time of Update: 2018-12-05
假設有矩形RECT1和RECT2、有八個頂點 1 bool test_collision__2(SDL_Rect *rect1, SDL_Rect *rect2) 2 { 3 int x1_1 = rect1->x; 4 int y1_1 = rect1->y; 5 int x1_2 = rect1->x + rect1->w; 6 int y1_2 = rect1->y; 7 int x1_3 = rect1->x;
Time of Update: 2018-12-05
最簡單當然是用typeid了、不過首先得加入標頭檔typeinfo例如想知道某個資料的類型、則使用name方法#include <typeinfo>using namespace std;int main(){int iobj; cout << typeid( iobj ).name() << endl; // 列印: int cout << typeid( 8.16 ).name() << endl; // 列印:
Time of Update: 2018-12-05
優先順序由上往下遞減 操作符功能用法 :: 全域域 ::name :: 類域 classtype::name :: 名字空間域 namespace::name . 成員選擇 object.member -> 成員選擇 pointer->member [] 下標 variable[expr] () 函數調用 name(expr_list) ()
Time of Update: 2018-12-05
explicit顯示定義、禁止編譯器隱式發生使用者轉換、如下class SmallInt {public: SmallInt(int i){}};class Number {public: Number(const
Time of Update: 2018-12-05
以下功能的實現 相關代碼實現 參照於網上 在此表示感謝當然按本樣本的操作思路 你可以實現自己想根的更多更有用的功能------------------------------// TextBox1 用於輸入所要查詢的連接埠// TextBox2 用於顯示 netstat -an 原資訊// TextBox3 用於顯示 本機連接埠資訊// TextBox4 用於顯示所查連接埠是否被佔用protected void Button1_Click(object sender, EventArgs e){
Time of Update: 2018-12-05
public static void AddMIMEType(){ DirectoryEntry rootEntry = GetDirectoryEntry("IIS://localhost/w3svc/1/root"); foreach(PropertyValueCollection pc in rootEntry.Properties) { Console.WriteLine(pc.PropertyName+":"+pc.Value); }
Time of Update: 2018-12-05
在C#中,聲明 兩個int類型的變數 i 和 j ,有兩種聲明方式:static void Main(string[] args) { int i; int j;}static void Main(string[] args) { int i, j;} 今天在看《C#進階編程》時,看到了他們的區別,記錄下來。 PS:i和j在同一範圍中。 int類型屬於實值型別,而實值型別是儲存在棧中的,棧的資料存放區屬於後進先出(last-in, first-out,
Time of Update: 2018-12-05
參考型別的分配相當複雜,該博文只說明這兩種執行個體化的區別。static void Main(string[] args) { Customer customer1; customer1 = new Customer();} Customer customer1; 聲明一個
Time of Update: 2018-12-05
2.屬性和方法的使用
Time of Update: 2018-12-05
using System;using System.Diagnostics;namespace ZZ{ class ZZConsole { [STAThread] static void Main(string[] args) { string cspPath = "D:\\ywmtest123\\ywmtest123.csproj"; string strRst =
Time of Update: 2018-12-05
C#日誌工具匯總2007-09-06 22:31log4net log4net是一個可以協助程式員把日誌資訊輸出到各種不同目標的.net類庫。它可以容易的載入到開發項目中,實現程式調試和啟動並執行時候的日誌資訊輸出,提供了比.net自己提供的debug類和trace類的功能更多。log4net是從java下有卓越表現的log4j移植過來的。它是apache基金資助的項目的一部分。NLog NLog是C#編寫的開源日誌類庫
Time of Update: 2018-12-05
.Net定時快顯視窗(c#) using System;using System.Collections;using System.ComponentModel;using System.Web;using System.Web.SessionState;using System.Threading;using System.Timers;namespace PopUp { public class Global : System.Web.HttpApplication { private
Time of Update: 2018-12-05
文章目錄 const成員函數名字尋找建構函式初始化列表預設建構函式隱式類類型轉換 const成員函數基於成員函數是否為 const,可以重載一個成員函數;同樣的,基於一個指標形參是否指向const,可以重載一個函數。const 對象只能使用 const 成員;非 const 對象可以使用任一成員,但非const版本是一個更好的匹配。每一個成員函數都有一個隱含的this指標,對於非 const 成員函數,該指標的類型是 T const
Time of Update: 2018-12-05
文章目錄 C Run-Time Libraries (CRT)Standard C++ LibraryWhat is the difference between msvcrt.dll and msvcr90.dll?What problems exist if an application uses both msvcrt.dll and msvcr90.dll? This topic discusses the various
Time of Update: 2018-12-05
文章目錄 複製建構函式解構函式 複製建構函式(copy
Time of Update: 2018-12-05
首先在使用位向量操作符時強烈建議使用無符號類型、因為有符號類型在不同的機器上有不同的實現、所以有可能造成代碼無法通用! 按位取反、按位或和按位與就不講了、都比較簡單易懂、講按位異或吧^、比如有兩個運算元、 12 ^ 17所有按位操作都要先轉換成二進位12為110017為10001按位異或的規則為同為1或者同為0則為0、否則都為1下面比較兩者、12的二進位為4位、要與17比較則12的二進位向左補001100 ->1210001 ->1711101 ->結果為29
Time of Update: 2018-12-05
如果邇經常使用C語言、最常用的語句莫過於列印輸出printf、這個是個奇怪的函數、可以直接輸出字串char*、也可以在後面帶上幾個不同的參數、可以帶可以不帶、限制也太寬鬆了吧、如果邇按平常定義函數的方法來定義這個printf、那樣肯定不行的、像int printf(char *, int)、對吧、所以省略符號就是專門對付這種情況的、如果邇寫函數時連使用者情境也不知道、乾脆就直接在參數列表寫上省略符號吧、讓使用者用到這個函數時、他自己來定義這個函數的參數類型和參數數量、所以這樣寫就OK了int
Time of Update: 2018-12-05
一、用於連結指示符比如邇想在c++代碼中插入c代碼或者FORTRAN或者Ada代碼、可以使用extern、比如想使用c形式的exit函數、在前面加上extern "C"就可以了、extern "C" void
Time of Update: 2018-12-05
產生表的實體類工具,有助於減少代碼量,加快開發速度.先看第一副圖根據輸入的串連伺服器位址 使用者名稱 登入資料庫名 密碼串連到資料庫.如果錯誤則提示串連失敗.第二幅圖先取的當前資料庫所有的使用者建立的表然後根據選中的表名取得資料庫中關於此表資訊的的系統資料表.然後將欄位類型轉換為C#資料類型.並輸出的TextBox這裡主要用到幾個表select * from sys.extended_properties 表注釋 和列注釋,列的排列順序(不帶列名)select * from
Time of Update: 2018-12-05
1 Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application(); 2 excelApp.Visible = true; 3 //得到WorkBook對象,開啟已有的檔案 4 Microsoft.Office.Interop.Excel.Workbook excelBook =