Time of Update: 2015-04-23
標籤:// 輸入a,b,c三個值,輸出其中最大者#include <stdio.h>int max( int a, int b, int c ){int temp;if( a > b && a > c )temp = a;if( b > a && b > c )temp = b;if( c > a && c > b )temp = c;return temp;}int main(){int
Time of Update: 2015-04-23
標籤:隱藏:是指衍生類別的函數屏蔽了與其同名的基類函數,規則如下:(1)如果衍生類別的函數與基類的函數同名,但是參數不同。此時,不論有無virtual關鍵字,基類的函數將被隱藏(注意別與重載混淆)。 很簡單略去(2)如果衍生類別的函數與基類的函數同名,並且參數也相同,但是基類函數沒有virtual關鍵字。此時,基類的函數被隱藏(注意別與覆蓋混淆)。 1 #include <iostream> 2 using namespace std; 3
Time of Update: 2015-04-23
標籤:1、error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.在工程的stdafx.h中,改為如下配置:#ifndef WINVER #define WINVER 0x0501 #endif#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501
Time of Update: 2015-04-24
標籤:在C語言中,我們經常碰到想要處理命令列的情況。當往往由於C語言字串比較難處理,最終出現各種奇怪的錯誤。現已演算法指令為例,說明C語言命令列處理的架構。演算法指令如所示:演算法指令加法ADD op1 op2減法SUB op1 op2乘法MUL op1 op2除法DIV op1 op2預期效果: 程式等待使用者輸入使用者指令,當程式鍵入演算法指令後,輸出正確的結果;如果出現非法操作,則輸出響應的出錯資訊。在main函數中,處理常式的代碼架構,do_line處理由命令列擷取的一行資料資料:1
Time of Update: 2015-04-23
標籤:譯密碼// 將“China”譯成密碼,密碼規律:用原來字母后邊第4個字母代替原來的字母。// 要求:先賦初值,然後分別用putchar和printf輸出#include <stdio.h>int main(){char c1 = 'C';char c2 = 'h';char c3 = 'i';char c4 = 'n';char c5 = 'a';c1 = c1 + 4;c2 = c2 + 4;c3
Time of Update: 2015-04-23
標籤:// 輸入一個字元,判斷它是否為大寫字母,如果是,將它轉換成小寫字母,如果不是不轉換#include <stdio.h>int main(){char ch;printf("請輸入一個字元:");scanf("%c",&ch);if(ch >= 'A' && ch <= 'Z')ch = ch +
Time of Update: 2015-04-24
標籤:c++ c++11 l 利用{}進行所有容器和資料結構的就地初始化,還可以直接用於返回值,對自訂類型進行就地初始化使用initializer_listl 通過右值引用,函數可以自由的返回大對象,同時帶資源賦值更加高效,由此指標可在任何情況下退出使用(庫除外)l 全域唯一資源可封裝為只可移動不可拷貝語義l
Time of Update: 2015-04-24
標籤:effective c++ 《Effective
Time of Update: 2015-04-23
標籤:注意:C++中double的表示是有誤差的,直接通過下面的例子看一下 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 double i; 6 for(i=0;i!=10;i+=0.2) 7 { 8 cout<<i<<endl; 9 }10 return 0;11
Time of Update: 2015-04-23
標籤:mfc 視窗風格 視窗樣式 擴充風格 擴充樣式 視窗風格(Window style)WS_BORDER 有邊框視窗 WS_CAPTION 必須和WS_BORDER風格配合,但不能與WS_DLGFRAME風格一起使用。指示視窗包含標題要部分。 WS_CHILD
Time of Update: 2015-04-21
標籤:樣本來源 :msdn 1.0 迭代器簡單的迭代器: public static void Main(string[] args) { foreach (int number in EvenSequence(5, 18)) { Console.Write(number.ToString() + " "); }
Time of Update: 2015-04-22
標籤: 用Keil軟體看別人的工程的時候,看到工程裡有.h檔案和.c檔案,比較納悶,因此收集資料解開心中疑惑。 1、首先是用Keil軟體來看工程的,所以工程中所看到的.h和.c檔案肯定是跟Keil軟體(編譯器)有關。
Time of Update: 2015-04-22
標籤:c語言 uptime 思路是通過讀取/proc/uptime獲得系統啟動時間長度。 使用命令cat /proc/uptime 通過man proc可以看到如下的資訊: /proc/uptime:This file contains two numbers: the uptime of the system (seconds), and the amount of time spent in idle process
Time of Update: 2015-04-21
標籤:#include<iostream>using namespace std;class Test{private:const int a; //const 成員變數只能在建構函式的成員初始化列表中初始化,不能在函數體中和其他地方static int b; //static 成員變數需要在全域範圍內初始化,格式: 類型名 類名::變數名 = 值static const int c;//static const
Time of Update: 2015-04-19
標籤:字串的基本使用定義方法:char name[10] ="jack"; 此時字串中共包含‘j’,’a‘,‘c‘,‘k‘,‘\0‘中括弧中的10代表該字串最多存放10個字元字串的輸出1.printf("jack");2.printf(name);
Time of Update: 2015-04-19
標籤: 1 #include<iostream> 2 #include<cstdlib> 3 4 struct node 5 { 6 7 int data; 8 node* next; 9 10 }; 11 12 class Stack 13 { 14 15 public: 16 17 node* head; 18 19 Stack(void); 20 ~Stack(); 21 22
Time of Update: 2015-04-23
標籤:C#隨機函數Random()的用法出自:http://www.cnblogs.com/wang726zq/archive/2012/04/28/2474711.htmlhttp://blog.csdn.net/xianxianmohan/article/details/6587909http://www.cnblogs.com/falla/archive/2010/01/29/1659399.htmlhttp://blog.csdn.net/pfe_nova/article/details
Time of Update: 2015-04-22
標籤:1:通過設定表單的 TransparencyKey實現 例:表單中的白色會變成透明 this.BackColor =Color.White; this.TransparencyKey = Color.White; TransparencyKey只支援透明或不透明,不支援過度色,比如PNG圖片中的從不透明到透明的過渡色會顯示出討厭的效果2:通過設定表單的 Opacity 實現
Time of Update: 2015-04-22
標籤:DescriptionYou are given a graph with N nodes and M edges. Then every time you are required to add an additional edge with weight Wi connecting the node Ai and Bi in the graph, and then calculate the sum of the edges’ weight of the
Time of Update: 2015-04-21
【Linux】在Ubuntu12.04中寫C語言與Helloworld,helloworldc語言Ubuntu12.04內建C的環境,比Windows開發一個C爽多了,此C就是大名鼎鼎學電腦都要學的C語言。尤其當年的C語言,下個VC6蛋疼的要死,然後又卡卡的,提示的錯誤又是英文的,非常不爽。在Ubuntu寫C的流程是這樣的。1、按Ctrl+Alt+R開終端,輸入:gedit helloworld.c建立一個.c檔案。2、之後直接開啟一個記事本介面讓你寫。就一個NotePad一樣,