#include <iostream> #include <string> using namespace std; void main(int argc,char* argv[]){ int a=10; int b=20; int &rn=a; cout<<rn<<"|"<<a<<endl; cout<<&rn<<
C#沒有提供播放MP3等音頻檔案的類,要編寫播放MP3等音頻檔案程式,必須使用第三方控制項或類。本文使用API函數mciSendString,編寫一個播放MP3等音頻檔案的類。 具體源碼如下: 一、使用API函數mciSendString構成的媒體播放類。using System; using System.Runtime.InteropServices; using System.Text; using
You want to store common data that is only needed in one location, using a singleton or static class. Save state between usages and store some caches. The object must be initialized only once and shared. Here we discuss the singleton pattern and
I struggled for ages with the problem of having controls show through a control that was painted on top of them. It seems that ControlStyles.SupportsTransparentBackColor just allowed the control to pick up the container's background colour/image
我的上一篇隨筆《c#擴充方法奇思妙用進階篇六:WinForm 控制項選取器》中給出了一個WinForm的選取器,其實質就是一個“樹”的遍曆器,但這個遍曆局限於WinForm的Control類。在資料結構中,“樹”的遍曆是一個通用演算法,那我們為什麼不做一個通用的“樹”遍曆擴充呢? 先看一個簡單的類People(將作為測試用的例子):Code highlighting produced by Actipro CodeHighlighter
簡言之:Java都是值傳遞(pass-by-value),而C++中包括值傳遞(pass-by-value)和引用傳遞(pass-by-reference)。先說Java,先做幾點說明:在Java中,無非就是兩種類型,即基本類型和從Object繼承下來的物件類型,而物件類型又包括String這種一旦初始化就不可改變內容的類型和BufferString這種可以初始化後可以改變內容的類型。然後看一下程式碼範例: java 代碼package test; public class Test {