Time of Update: 2015-04-24
標籤:此處僅給出代碼實現,具體原理及過程請看前面的博文註:本測試題本機測試通過,但不知為何在OJ上老是出現執行階段錯誤提示,有大神看出問題請指教~~測試檔案輸入格式如下:2 10 0.01 102104 3 3999001600 3 3299002400 3 3690001416 2 2320003000 4 5399001985 4 2999001534 3 3149001427 3 1989991380 3 2120001494 3
Time of Update: 2015-04-24
標籤:effective c++ 讀書筆記 仔細區別pointers和references。指標和引用有些相似,他們本身都是對存在於某個地方的對象(不是指class)的指示,但是他們有著本質的區別。指標變數儲存所指對象的地址,所指的對象可以是null,只要可以定址就行。而引用是某個已經存在對象的別名,所以不可以先聲明一個引用,經過一段時間(代碼)後讓它指向某個對象。最好使用C++轉型操作符。C+
Time of Update: 2015-04-24
標籤:// 在全系1000學生中,徵集慈善募捐,當總數達到10萬元時就結束,統計此時捐款的人數,以及平均每人捐款的數目#include <stdio.h>#define MAX 100000int main(){int i;float sum = 0;float ave,mei;for( i = 1; i <= 1000; i++){printf("請輸入要捐款的金額:");scanf("%f",&mei);sum = sum +
Time of Update: 2015-04-24
標籤:// 要求輸出100~200之間不能被3整除的數#include <stdio.h>int main(){int i;printf("100~200之間不能被3整除的數:\n");for(i = 100; i <= 200; i++){if(i % 3 != 0)printf("%d\t",i);}printf("\n");return 0;}<img
Time of Update: 2015-04-24
標籤:// 用π/4 ≈ 1 - 1/3 + 1/5 - 1/7 +... 公式求π的近似值,直到發現某一項的絕對值小於10^6為止。#include <stdio.h>#include <math.h>int main(){double sign = 1.0;int i;double sum = 0.0;for(i = 1;fabs(i) < pow( 10,6 ); i = i + 2){sum = sum + sign / i;sign = ( -1 ) *
Time of Update: 2015-04-24
標籤:// 輸出以下4*5的矩陣// 1 2 3 4 5// 2 4 6 8 10// 3 6 9 12 15// 4 8 12 16 20#include <stdio.h>int main(){int i,j,k,l;for( i = 1; i <= 5; i++ )printf("%d\t",i);printf("\n");for( j = 2; j <= 10; j = j + 2
Time of Update: 2015-04-24
標籤:// 譯密碼。將字母變成其後的第4個字母,非字母不變#include <stdio.h>int main(){char c;c = getchar();while( c != '\n' ){if( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) ){if( ( c >= '
Time of Update: 2015-04-24
標籤:斐波那契數列// 求斐波那契數列的前40個數。特點,第1,2個數為1,從第三個數開始,該數是前面兩個數之和#include <stdio.h>int main(){int a = 1;int b = 1;int c,i;printf("%d\t%d\t",a,b);for(i = 3; i <= 40; i++){c = a + b;printf("%d\t",c);a = b;b =
Time of Update: 2015-04-24
標籤:(1)C語言跟記憶體配置方式<1>從靜態儲存地區分配. 記憶體在程式編譯的時候就已經分配好,這塊記憶體在程式的整個運行期間都存在.例如全域變數、static變數.<2>在棧上建立
Time of Update: 2015-04-24
標籤:摘要 總結OC中數組排序3種方法:sortedArrayUsingSelector:;sortedArrayUsingComparator:;sortedArrayUsingDescriptors:數組排序 Objective-C 目錄[-]1、簡單排序(sortedArrayUsingSelector:)2、利用block文法(sortedArrayUsingComparator:)3、進階排序(sortedArrayUsingDescriptors:)大體
Time of Update: 2015-04-24
標籤:#include <iostream>#include <typeinfo>using namespace std;template <class T>T add(T one, T two){ cout << "類型:" << typeid(T).name() << endl; return one + two; //
Time of Update: 2015-04-24
標籤:1.聲明:#include <string>#include <iostream>using namespace std;class AirlineTicket{public :AirlineTicket();~AirlineTicket();int calculatePriceInDollars();string getPassengerName() const;void setPassengerName(string inName);int
Time of Update: 2015-04-24
標籤:Effective C++ Chapter 1. 讓自己習慣C++(Accustoming Yourself to C++) Item 3. 儘可能使用 const (Use const whenever possible) 1. const 與語義約束 const 允許指定一個語義約束(也就是指定一個“不該被改動”的對象),而編譯器強制實施這項約束。它可以在 classes 外部修飾 global 或
Time of Update: 2015-04-24
標籤:本文並不是什麼高深的文章,只是VS2008應用中的一小部分,但小部分你不一定會,要不你試試: 本人對於分布式開發應用的並不多,這次正好有一個項目要應用web service,我的開發環境是vs2008,之所以沒有選擇現在熱門的WCF,本人有如下原因: 1:負責開發Web
Time of Update: 2015-04-24
標籤: //Jack的賬戶資訊 帳號、餘額、姓名、年齡 PersonAccount Jack = new PersonAccount("201506", 2000, "Jack", 20); //Tom的賬戶資訊 PersonAccount Tom = new PersonAccount("201507", 5000, "Tom", 55); /**
Time of Update: 2015-04-24
標籤:最近需要寫一個C組成的伺服器端與C#的用戶端進行互動的軟體,剛開始寫的時候發現C#端解析時候出現了故障,經過仔細研究後發現原因是發送方傳輸太快,出現了所謂粘包的現象。也就是在C#端的Receive()。這個函數返回的是多個結構體連起來的資料,這當然是無法解析的。我的解決方案如下: List<byte[]> listb = new List<byte[]>();..........int recv = newclient.Receive(b1);for (int x
Time of Update: 2015-04-24
標籤:(修改註冊表)【設定開機自啟動】using Microsoft.Win32;//添加命名空間public static bool SetAutoRun(string keyName,string filePath) { try { RegistryKey
Time of Update: 2015-04-24
標籤:1.使用ResourceManagerstring st = Properties.Resources.ResourceManager.GetString(tableName);value = Properties.Resources.ResourceManager.GetObject(fileName, Properties.Resources.Culture) public static Bitmap GetImageByName(string
Time of Update: 2015-04-24
標籤:holydancer原創,如需轉載,請在顯要位置註明:轉自holydancer的CSDN專欄,原文地址:http://blog.csdn.net/holydancer/article/details/7343561 objective
Time of Update: 2015-04-24
標籤: 1 #include<stdio.h> 2 #include<stdlib.h> 3 typedef char datetype;/*定義新的資料類型名*/ 4 typedef struct node 5 { 6 datetype date; 7 struct node *next; 8 }listnode; 9 typedef listnode *linklist;10 int delete(linklist h,int num)/*刪除結點*/