Time of Update: 2018-12-04
輸入:第一個字串: "This is fishsky 's Chinese site: http://www.fishsky.com.cn/cn"子串: "fishsky"輸出: "nc/nc.moc.fishsky.www//:ptth :etis esenihC s'fishsky si
Time of Update: 2018-12-04
(一)遞迴解/*這個函數的功能是,對字串進行判斷,從第一個字元開始,判斷其是否為空白,不為空白,則遞迴調用,對下一個判斷,直到為空白,則返回,從最裡層列印輸出,即最後一個字元列印輸出*/ void inverse(char *p) { if( *p == '/0' ) return; inverse( p+1 ); printf( "%c", *p ); } int main(int argc, char *argv[]) {
Time of Update: 2018-12-04
#include <stdio.h>#define maxsize 100#define NULLKEY -1#define DELKEY -2typedef int KeyType;typedef char* InfoType;typedef struct{ KeyType key; InfoType data; int count;} HashTable[maxsize];void InsertHT(HashTable ha,int &n,KeyType k,int
Time of Update: 2018-12-04
Timer事件,即定時器事件,是在遊戲編程中,經常使用的一個事件。藉助它可以產生定時執行動作的效果。這篇文章,就和大家一起探討一下如何使用SetTimer()函數。 1、SetTimer定義在那裡? SetTimer表示的是定義個定時器。根據定義指定的視窗,在指定的視窗(CWnd)中實現OnTimer事件,這樣,就可以相應事件了。SetTimer有兩個函數。一個是全域的函數::SetTimer()UINT SetTimer( HWND
Time of Update: 2018-12-04
#include <iostream>using namespace std;int num=0; //全域對迭代的次數進行計數int Q[100]; //每次迭代的結果所在數組typedef struct{ int b; int s; int g;} CType;int quwei(int number,CType state[]){ number = number%1000; state[num].b = number/100; //百位 state[num].s
Time of Update: 2018-12-04
在這個世界上,有數百萬的人熱衷於軟體開發,他們有很多名字,如:軟體工程師(Software Engineer),程式員(Programmer),編碼人(Coder),開發人員(Developer)。經過一段時間後,這些人也許能夠成為一個優秀的編碼人員,他們會非常熟悉如何用電腦語言來完成自己的工作。但是,如果你要成為一個優秀的程式員,你還可以需要有幾件事你需要注意,如果你能讓下面十個條目成為你的習慣,那麼你才能真正算得上是優秀程式員。1.
Time of Update: 2018-12-04
#include <iostream>using namespace std;const int N = 1000;void SelSubstr(int flag[],int count){ for(int i = 0;i < count;i++) { flag[i] = flag[i]^1; //當前元素取反後為0則停止。這樣取反正好有2^n-1種情況,而且不重複。 if(!flag[i]) break; }}void print(int flag[],int
Time of Update: 2018-12-04
#include <iostream>#include <fstream>using namespace std; int a[100]; //存放從檔案中讀入的整數值的數組int n = 0; //記錄數組中 //返回數組中的最大值int Maxa(int a[],int n){ int max = a[0]; for(int i=1;i<n;i++) { if(a[i]>max) max = a[i]; } return
Time of Update: 2018-12-04
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream.h>char* commonstring(char* str1,char* str2){ char* shortstr,*longstr; char* substr; if(str1==NULL||str2==NULL) return
Time of Update: 2018-12-04
一、遞迴(1)=====#include <iostream> #include <string> using namespace std; string DecToStr(unsigned n) { return n > 0 ? DecToStr(n/10) + static_cast<char>(n%10 + '0') : ""; } int main() { long n=12345608; cout << DecToStr(n)&
Time of Update: 2018-12-04
寫一個3D向量類CVector3D,要求含三種建構函式,並有拷貝,點積,叉積,求模,單位化等操作,並實現”+; -; =; ==; +=; -=; *; [ ]” 等運算子的重載。 註:由於開始定義的時候,沒有將三維資料對應的成員變數使用數組存放,因此重載下標運算子'[ ]'沒有意義。 ================================================ #include <iostream>#include <cmath>using
Time of Update: 2018-12-04
#include <iostream>using namespace std; char* LoopRightMove(char* str,int n){ int strLen = strlen(str); n = n % strLen; //計算字元尾部的字串移動到頭部的個數 char* result = new char[strLen+1]; for(int i=0;i<strLen;i++) { if(i<n) result[i] = str[strLen-
Time of Update: 2018-12-04
<!--@page { margin: 0.79in }H2 { margin-top: 0.18in; margin-bottom: 0.18in; line-height: 173%; page-break-inside: avoid }H2.western { font-family: "Arial", sans-serif; font-size: 16pt }H2.cjk { font-family: "黑體", "SimHei"; font-size: 16pt }H2.ctl
Time of Update: 2018-12-04
來自《C/C++軟體工程師就業求職手冊》 p150書中的解法是錯的 #include <iostream>using namespace std; void Calculate(const char* str,int& max0,int& max1){ int temp0 = 0; //儲存連續0的長度 int temp1 = 0; while(*str) //遍曆字串 { if(*str=='0') //當前的是0 { max0++; if(*(
Time of Update: 2018-12-04
來自:http://it.btbctv.cn/n/200609/16/n20060916_61682.shtml 一、概述:Symbian OS是一個多任務的作業系統,那麼為了實現多任務,同時使系統能夠快速響應,高效的進行事件處理,並減輕應用程式員的工作負擔(申請大多數耗時的操作(例如檔案系統)由服務提供器來完成,服務提供器完成程式員提交的請求後,將會返回給程式員一個成功或失敗的訊號。), Symbian
Time of Update: 2018-12-04
//////////////////////////////////////r-排列產生演算法//回溯法產生從n個元素中取出r個元素的所有排列情況#include<stdio.h>#include<string.h>const int N = 10000;int n, r;int res[N];bool used[N];int counter;void output(){ counter++; printf("Case %4d:",
Time of Update: 2018-12-04
#include <iostream>using namespace std; //在一個含有不重複的字串中尋找一個字元的位置,不存在返回NULL char* findc(char* p, char c){ int flag = 0; //預設不存在 while(*p++) { if(*p==c) { flag = 1; break; } } if(flag) return p; else return NULL;}char* DeleteStr(char*
Time of Update: 2018-12-04
Symbian學習筆記(2)——基本概念 第一次開啟SymbianC++的程式原始碼,第一感覺就是“這是C/C++嗎?咋這麼眼生啊”。看代碼看書,才算是稍稍明白了一點,其實無非就是typedef罷了,symbian可比brew定義了更多的東西。這是以後幹活的基礎,所以做個筆記,省得忘了。一、基礎資料型別 (Elementary Data Type)這個比較簡單,都在e32def.h中寫著呢。也就是以下這幾個類型要注意一下,以後照著寫罷了,含義也很明了,不用多說。typedef void
Time of Update: 2018-12-04
1. char* strcat(char* dest,char* src) #include <stdio.h>#include <stdlib.h>char* mystrcat(char* des,char* src){ char* ret = des; while(*des++); //是指標指向末尾的下二位 des--; //指標指向'/0' while(*des++=*src++); return ret;}int main(){ char*
Time of Update: 2018-12-04
#include <iostream>#include <string.h>using namespace std;int Num(char *str);int main(){ int n; char* str = new char[100]; cout<<"請輸入一個要轉化為整數的字串:"; cin>>str; if(*str=='-') n = -(Num(str+1)); else n =