原创 字符個數統計

編寫一個函數,計算字符串中含有的不同字符的個數。字符在ACSII碼範圍內(0~127)。不在範圍內的不作統計。 #include<iostream> #include<string> using namespace std; int m

原创 遺傳算法_C語言

#include<stdio.h> #include<stdlib.h> #include<math.h> #include<time.h> #define POPSIZE 500 #define maximization 1 #defi

原创 矩陣乘法計算量計算(stack + 結構體)

輸入n個矩陣的維度和一些矩陣鏈乘表達式,輸出乘法的次數。如果乘法無法進行,輸出error。假定A是m*n矩陣,B是n*p矩陣,那麼AB是m*p矩陣,乘法次數爲m*n*p。如果A的列數不等於B的行數,則乘法

原创 表示數字

#include<iostream> #include<string> using namespace std; string s; int numo = 0; int main(){ cin>>s; for(int i

原创 整形數組合並_用 set

#include<iostream> #include<set> using namespace std; set<int> intSet; int a, b; int a1[100], b1[100]; int main(){

原创 Java實現各種排序

選擇排序+插入排序+冒泡排序+快速排序+歸併排序 package javaFoundations; /* * Contact.java * Represents a phone contact that implements Com

原创 關鍵字static和const的作用

這個簡單的問題很少有人能回答完全。在C語言中,關鍵字static有三個明顯的作用: 1)在函數體內,一個被聲明爲靜態的變量在這一函數被調用過程中維持其值不變(該變量存放在靜態變量區)。 2) 在模塊內(但在函數體外),一個被聲明爲靜態的變

原创 C++字符串string類提供的處理字符串的函數

string類     +string() +string(value: string) +string(value: char[]) +string(ch: char, n: int) 構造一個空字符串 由指定的字符串文字常量構造

原创 關於C中指針的引用*&

/*這部分是關於指針的引用*&的說明  指針的引用,相當於傳遞的是:     指針的指針,   這樣指針的數值是可以改變的      而單傳遞指針,不傳遞指針的引用,那麼指針指向的數據是可以改變,而指針本身是不可以改變的  fun(int

原创 STL容器簡單用例

#include <iostream> #include <vector> #include <list> #include <deque> #include <set> #include <stack> #include <queue>

原创 成績排序 (結構體+自定義排序)

#include<iostream> #include<string> #include<algorithm> using namespace std; struct stu{ // 定義一個結構體     int index;  

原创 字符統計(結構體)_nice

果統計的個數相同,則按照ASII碼由小到大排序輸出 。如果有其他字符,則對這些字符不用進行統計。 實現以下接口: 輸入一個字符串,對字符中的各個英文字符,數字,空格進行統計(可反覆調用) 按照統計個數由多到少輸出統計結果,如果統計的個

原创 字符串分割

#include<iostream> #include<stdio.h> #include<string> using namespace std; void buLing(string s); void chaiFen(string

原创 C語言strcpy函數

strcpy的函數的實現 char * strcpy(char *dst,const char *src) //[1] { assert(dst != NULL && src != NULL); //[2] c