原创 C++:靜態成員

寫在class裏面的,都是聲明,就是說,告訴編譯器有這麼一個東西,都是不知道在哪,而不是definition(定義就會具體告訴函數的相關信息)。對於C++來說,函數本來就是全局的,函數又不跟着對象走。不能在一個靜態的函數裏面,使用了一個非

原创 如何寫數學建模競賽論文

如何寫數學建模競賽論文一、寫好數模論文的重要性1.成績好壞、獲獎級別高低,數模論文的答卷是唯一的依據。2.論文答卷是競賽活動的成績結晶的書面形式。3.寫好論文答卷的訓練,是科技寫作的一種基本訓練。4.論文答卷的評閱原則:假設的合理性,建模

原创 C++:類型轉換

在一個類裏面,用X::operator double() const{}//意思是把類裏面的東西變成double類的 通常有個const用來保證不會修改自己 儘量用自己寫的函數來進行類型轉化,自動的往往容易錯,自己寫的一眼就能夠看出來。/

原创 STL(標準模板類庫)簡介

STL:標準模板類庫map:集合vector:矢量(C++中叫做容器)list:表 迭代器:廣義指針vector類的運用:#include <iostream> #include <vector> using namespace std;

原创 階乘的循環使用

#include <stdio.h> #include <stdlib.h> int main() { int val; int i,mult=1; printf("請輸入一個數字:\n"); print

原创 C++中的模板(template)

編譯器對聲明只做一件事情:記錄下來編譯器一個時間只能夠編譯一個單元。template <class T>//把函數做成模板 void swap(T& x,T& y){ T temp = x; x = y; y =

原创 基礎的動態分配

#include <stdio.h> #include <stdlib.h> #include <malloc.h> void f(){ double *q = (double*)malloc(200); } int main

原创 數學建模小白必備手冊

數學建模小白必備手冊 賽前儲備 一、建模基礎知識、常用工具軟件的使用1、掌握建模必備的數學基礎知識(如初等數學、高等數學等),數學建模中常用的但尚未學過的方法,如圖論方法、優化中若干方法、概率統計以及運籌學等方法。2、針對建模特點,結合典

原创 鏈表的基本操作

鏈表的增、刪、改、查。#include <stdio.h> #include <stdlib.h> #include <malloc.h> #include <stdbool.h> typedef struct Node{ i

原创 流的基本概念

cin:標準輸入cout:標準輸出cerr:標準錯誤clog:標準日誌 也可以用get()函數來讀東西set:置1reset:置0istream& operator>>(istream is,T& obj){ return is;

原创 運算符重載

class Integer{ public: Integer(int n=0):i(n){} const Integer operator+(const Integer& n)const{

原创 基本的遞歸

#include <stdio.h> #include <stdlib.h> void f(); void g(); void k(); void f(){ printf("FFFF\n"); g(); pri

原创 造型和多態性

C++:造型:還是子類的對象(學生還是學生,只是看待的眼光變了,當做人看了)cast:叫做造型,數據沒變,數據沒有丟upcast:拿一個子類對象當做父類對象來看待C:類型轉化 多態性(polymorphism):      只要前面的父類

原创 棧的基本操作

#include <stdio.h> #include <stdlib.h> #include <malloc.h> #include <stdbool.h> typedef struct Node{ int data;

原创 鏈表的創建和遍歷

#include <stdio.h> #include <stdlib.h> #include <malloc.h> struct Node{ int data;//數據域 struct Node *pNext;//