C
wjfqvi
这个作者很懒,什么都没留下…
展开
-
c++指针
#include <iostream>using namespace std;int main (){ int age = 27; int *page = &age; string name = "WJF"; string *pname = &name; int numbers[5] = {1,2,3,4,5}; c...原创 2018-12-08 11:46:54 · 88 阅读 · 0 评论 -
C++的数据类型和输入输出
#include&lt;iostream&gt;#include&lt;cmath&gt;using namespace std;int main(){ cout &lt;&lt; "Size of char : " &lt;&lt; sizeof(char) &lt;&lt; endl; c原创 2018-12-02 15:03:32 · 292 阅读 · 0 评论 -
c++ 类class
声明一个book类:#include<iostream>using namespace std;class Book{ public: string name; string author; int pages;};int main(){ Book book1; book1.name = "Lord of Ring...原创 2018-12-08 15:48:06 · 167 阅读 · 0 评论 -
Fortran 和 c++ 的 插入排序 insertion sort 代码
插入排序法,代码如下:subroutine insertionsort(a) implicit none integer :: a(:) integer :: temp integer :: n , ii,jj n=size(a) do ii=2,n do jj=ii,2,-1 if(a(jj) &amp;lt; a(jj-1)) t...原创 2018-12-07 12:49:19 · 480 阅读 · 0 评论 -
C++ 标准库中的复数类
参考:http://www.cplusplus.com/reference/complex/complex/#include&lt;complex&gt;#include&lt;iostream&gt;using namespace :: std; int main(){ std::complex&lt;double&gt; cnum1; std::complex&原创 2019-02-13 11:06:11 · 2271 阅读 · 0 评论 -
C++析构数组的顺序
使用析构函数析构数组的时候,析构的顺序是正向还是反向?写一段代码来看看:#include<stdio.h>class A{ public: A(){printf("A::A()\naddress=%p\n",this);} ~A(){printf("~A::A() i=%d\naddress=%p\n",i,this);} void setA(int ii){i=...原创 2019-02-26 13:52:01 · 725 阅读 · 0 评论 -
C++ Standard Template Library (STL)
模板 Template#include<iostream>using namespace std;template <typename T>T func(T a,T b){ return a+b;}int main(){ int a=1; int b=2; float c=3.0; float d=4.5; ...原创 2019-03-12 15:16:57 · 359 阅读 · 0 评论