360doc--ONLY_影的文章 http://www.ahfyzs.com/rssperson/21044891.aspx 360doc (http://www.ahfyzs.com) zh-cn 360doc--個人圖書館 三角函數(shù)公式大全 http://www.ahfyzs.com/content/11/1229/16/567453_175849964.shtml 2017/1/4 9:55:15
三角函數(shù)公式大全三角函數(shù) 公式公式分類 同角三角函數(shù)的基本關系 倒數(shù) 關系: tan cot=1 sin csc=1 cos sec=1 商的關系: sin/cos=tan=sec/csc cos/sin=cot=csc/sec 平方關系: sin^2()+cos^2()=1 1+tan^2()=sec^2() 1+cot^2()=csc^2() 平常針對不同條件的常用的兩個公式 sin^2()+cos^2()=sin^2(α/2)=(1-cosα)/2 cos^2(α/2)=(1+cosα)/2 tan^2(α/2)=(1-cosα)/(1+cosα) tan(α/2)=sinα/(1+cosα)=(1-cosα)/sinα萬能公式。
C++中類型轉換 http://www.ahfyzs.com/content/15/0308/20/21044891_453618537.shtml 2015/3/8 20:44:47
reinterpret_cast,dynamic_cast,const_cast,static_cast都是函數(shù)。這種轉換不用修改指針變量值存放格式(不改變指針變量值),只需在編譯時重新解釋指針的類型就可做到.int *pi = reinterpret_cast<int*>(pd);即括號中的變量只能是指針變量,且< >中的寫的必須是某種類型變量的指針,即int *, double *等等。如果對無繼承關系或者沒有虛函數(shù)的對象指針進行轉換、基本類型指針轉換以及基類指針轉換為派生類指針,都不能通過編譯。
for_each http://www.ahfyzs.com/content/15/0304/17/21044891_452537222.shtml 2015/3/4 17:48:28
template <class InputIterator, class Function> Function for_each (InputIterator first, InputIterator last, Function f);其實現(xiàn):[cpp] view plaincopyprint?template<class InputIterator, class Function> Function for_each(InputIterator first, InputIterator last, Function f) { for ( ; first!=last; ++first ) f(*first); return f; } 它返回f已在算法內(nèi)部變動過的一個副本。
C++函數(shù)對象與函數(shù)指針不同之處 http://www.ahfyzs.com/content/15/0304/16/21044891_452513339.shtml 2015/3/4 16:25:36
C++函數(shù)對象與函數(shù)指針不同之處在C++編程語言中,有很多功能都與C語言相通,比如指針的應用等等。在這里我們介紹的則是一種類似于函數(shù)指針的C++函數(shù)對象的相關介紹。C++函數(shù)對象不是函數(shù)指針。這是入門級的隨筆,說的是函數(shù)對象的定義,使用,以及與函數(shù)指針,成員函數(shù)指針的關系。既然C++函數(shù)對象與函數(shù)指針在使用方式上沒什么區(qū)別,那為什么要用函數(shù)對象呢?
面試中經(jīng)常讓寫的關于鏈表的代碼 http://www.ahfyzs.com/content/15/0303/11/21044891_452177184.shtml 2015/3/3 11:26:44
26 } 27 void insert_from_tail(Node *tmp) 28 { 29 if(head == NULL) 30 { 31 head = new Node();
使用一維數(shù)組和二維數(shù)組來存儲矩陣并進行乘法運算 http://www.ahfyzs.com/content/15/0302/15/21044891_451981256.shtml 2015/3/2 15:21:50
幾個STL算法:includes,set http://www.ahfyzs.com/content/15/0206/14/21044891_446688217.shtml 2015/2/6 14:34:33
template<class inputIterator1, class inputIterator2>template<class inputIterator1 , class inputIterator2, class Comp>set_differrence:包含在第一個有序集合中,但不包含第二個有序集合中的元素,這些不同的元素復制到最后一個參數(shù)中,最后一個參數(shù)是一個保存這些元素的容器的首迭代器,這個容器必須預先分配足夠的空間來容納元素。template<class inputIterator1, class inputIterator2,
istringstream、ostringstream、stringstream 類介紹 . http://www.ahfyzs.com/content/15/0206/09/21044891_446616270.shtml 2015/2/6 9:21:10
初始化:使用字符串進行初始化istringstream istr("1 56.7"); istr.str("1 56.7");//把字符串"1 56.7"存入字符串流中。描述:是對istringstream和ostringstream類的綜合,支持<<, >>操作符,可以進行字符串到其它類型的快速轉換stringstream的構造函數(shù)原形如下: stringstream::stringstream(string str);初始化:使用字符串進行初始化stringstream str("1234"); str.str("1234");//把字符串"1234"存入字符串流中。
C++ list模板類介紹 http://www.ahfyzs.com/content/15/0202/21/21044891_445805310.shtml 2015/2/2 21:32:16
list::~list()void print(list<int> l) { for(list<int>::iterator it = l.begin();} int main(void) { // list::list() list<int> first;list<int> fifth(arr, arr + sizeof(arr)/sizeof(int));list<int> l(arr, arr + sizeof(arr)/sizeof(int));// list::emplace emplace_front emplace_back list<pair<int, char>> pl;合并兩個list,在合并之前兩個list應該先排序,合并之后的list依然有序。
C++中引用(&amp;)的用法和應用實例 http://www.ahfyzs.com/content/15/0201/14/21044891_445461105.shtml 2015/2/1 14:56:06
//第1種情況,系統(tǒng)生成要返回值的副本(即臨時變量) float &b=fn1(10.0); //第2種情況,可能會出錯(不同 C++系統(tǒng)有不同規(guī)定) //不能從被調函數(shù)中返回一個臨時變量或局部變量的引用 float c=fn2(10.0); //第3種情況,系統(tǒng)不生成返回值的副本 //可以從被調函數(shù)中返回一個全局變量的引用 float &d=fn2(10.0); //第4種情況,系統(tǒng)不生成返回值的副本 //可以從被調函數(shù)中返回一個全局變量的引用 cout<<a<<c<<d;}
STL vector用法介紹 http://www.ahfyzs.com/content/15/0201/14/21044891_445459268.shtml 2015/2/1 14:47:49
vector容器提供了很多接口,在下面的表中列出vector的成員函數(shù)和操作。很多時候我們不必要知道vector里面有多少數(shù)據(jù),vector里面的數(shù)據(jù)是動態(tài)分配的,使用push_back()的一系列分配空間常常決定于文件或一些數(shù)據(jù)源。vector能夠非常容易地添加數(shù)據(jù),也能很方便地取出數(shù)據(jù),同樣vector提供了erase(),pop_back(),clear()來刪除數(shù)據(jù),當你刪除數(shù)據(jù)的時候,你應該知道要刪除尾部的數(shù)據(jù),或者是刪除所有數(shù)據(jù),還是個別的數(shù)據(jù)。
C++中vector的實現(xiàn) http://www.ahfyzs.com/content/15/0130/15/21044891_445005116.shtml 2015/1/30 15:48:53
class reverse_iterator { public: reverse_iterator(iterator it = NULL):current_(it) {} iterator base() const { return current_;friend bool operator==(const reverse_iterator &lhs, const reverse_iterator &rhs) { return lhs.current_ == rhs.current_;template <typename T>inline void Vector<T>::create(const_iterator i, const_iterator j){
Ubuntu14.10&nbsp;安裝搜狗拼音輸入法 http://www.ahfyzs.com/content/15/0129/21/21044891_444837715.shtml 2015/1/29 21:52:25
今天在安裝搜狗時,按14.04的思路,不必卸載ibus,直接雙擊搜狗的deb安裝,完成后重啟即可。執(zhí)行命令:sudo apt-get remove ibus 重啟計算機后,此時已經(jīng)可以使用搜狗輸入法了。執(zhí)行以下命令:sudo apt-get install ibus #此命令安裝ibus-gtk,ibus-gtk3 sudo apt-get install linux-generic #此命令安裝linux-generic sudo apt-get install ubuntu-desktop #此命令修復ubutun桌面 以上三個命令完美修復問題。
Qt5.2在ubuntu下解決GL/gl.h:Nosuchfileordirectory與&amp;nbs http://www.ahfyzs.com/content/15/0126/14/21044891_443821844.shtml 2015/1/26 14:41:31
String類 寫出類的成員函數(shù)實現(xiàn) http://www.ahfyzs.com/content/15/0122/16/21044891_442857790.shtml 2015/1/22 16:08:34
String類 寫出類的成員函數(shù)實現(xiàn)。String(const char *str = NULL);String(const String &another);String &operater =(const String &rhs);String::String(const char *str)String::String(const String &another)String& String::operator =(const String &rhs)m_data = new char[strlen(rhs.m_data) + 1];String::~String()
String類 寫出類的成員函數(shù)實現(xiàn) http://www.ahfyzs.com/content/15/0122/16/21044891_442857650.shtml 2015/1/22 16:08:07
String類 寫出類的成員函數(shù)實現(xiàn)。String(const char *str = NULL);String(const String &another);String &operater =(const String &rhs);String::String(const char *str)String::String(const String &another)String& String::operator =(const String &rhs)m_data = new char[strlen(rhs.m_data) + 1];String::~String()
string::resize() http://www.ahfyzs.com/content/15/0122/16/21044891_442857514.shtml 2015/1/22 16:07:40
string::resize()void resize( size_type size, char val = char() );resize函數(shù)用來改變string的大小,如果size小于來string的size大小,則截取前size個字符,如果大于,則用空格補充。#include<iostream>#include<string>using namespace std;s.resize(20,''a'');cout<<s.length()<<endl;cout<<s.capacity()<<endl;cout<<s<<endl;s.resize(12);
C++ vector用法 http://www.ahfyzs.com/content/15/0116/15/21044891_441323873.shtml 2015/1/16 15:47:02
(2)創(chuàng)建vector對象,vector<int> vec;(6)插入元素: vec.insert(vec.begin()+i,a);在第i+1個元素前面插入a;(7)刪除元素: vec.erase(vec.begin()+2);刪除第3個元素。vec.erase(vec.begin()+i,vec.end()+j);int main(){ vector<Rect> vec;vec.push_back(rect);vector<Rect>::iterator it=vec.begin();reverse(vec.begin(),vec.end());sort(vec.begin(),vec.end());調用時:sort(vec.begin(),vec.end(),Comp),這樣就降序排序。
gethostbyname() http://www.ahfyzs.com/content/15/0113/12/21044891_440379733.shtml 2015/1/13 12:04:48
gethostbyname()struct hostent *gethostbyname(const char *name);表示的是主機ip地址的類型,到底是ipv4(AF_INET),還是pv6(AF_INET6)const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) :char *ptr, **pptr;if((hptr = gethostbyname(ptr)) == NULL)pptr=hptr->h_addr_list;inet_ntop(hptr->h_addrtype, *pptr, str, sizeof(str)));inet_ntop(hptr->h_addrtype, hptr->h_addr, str, sizeof(str)));
幾個好用的makefile&nbsp;幾乎可以不用修改(轉) http://www.ahfyzs.com/content/15/0113/09/21044891_440323880.shtml 2015/1/13 9:01:50
幾個好用的makefile 幾乎可以不用修改(轉)Makefile.用 makefile 來編譯工程,對很多朋友來說都是一件麻煩而痛苦的事情,這里我寫了幾個 makefile ,專門提供給那些曾經(jīng)被makefile 困擾的朋友,根據(jù)生成的目標文件不同,我將 makefile 分成了三份:生成可執(zhí)行文件的 makefile,生成靜態(tài)鏈接庫德 makefile ,生成動態(tài)鏈接庫的 makefile 。OBJS :=$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE)))objs : $(OBJS)