1/  int 转换成 string 格式

#include<sstream>

std::stringstream ss;

str::string temp;

int n;

ss<<n;

ss>>temp;

//再次使用时  需要  ss.clear();  或者重新定义

方法1:

string转换成int

atoi(str.c_str()) 函数

string s; int re;

re= atoi(s.c_str());

方法2 :

int b= stoi(string a);

3.c++中指针数组和数组指针作为函数参数时,该如何传递

#include<iostream>
#include<cstdio>
using namespace std; void FuncT(int iNum, char *asIP[])
{
for (int i = ; i < iNum; ++i)
{
printf("%s\n", asIP[i]);
}
}
int main()
{
char asIP[][];
cout << asIP << " " << asIP[] << endl;
char *p[] ;
p[] = asIP[];
p[] = asIP[]; strcpy_s(asIP[], "172.2.2.1");
strcpy_s(asIP[], "172.23.3.2"); FuncT(, p);
system("pause");
return ;
}
//形参和实参的匹配形式
// 实参 形参
**p **p
p[][] (*p)[]
*p[] **p
(*p)[] *p

  

#include <mem.h> 
void* memset(void* s, int c, size_t n)
{
    unsigned char* p = (unsigned char*) s;
    while (n > 0) {
    *p++ = (unsigned char) c;
    --n;
    }
    return s;

memset()的函数, 它可以一字节一字节地把整个数组设置为一个指定的值。
memset()函数在mem.h头文件中声明,它把数组的起始地址作为其第一个参数,
第二个参数是设置数组每个字节的值,第三个参数是数组的长度(字节数,不是元素个数)。

4/ C++中禁止 拷贝构造函数 和 赋值构造函数

设为private ,但是这种方法 它的 friend class 和 friend 函数 都可以访问拷贝构造

c++11 标准中可以通过delete操作禁掉 他们

  T(T&temp)=delete;          // 再次调用拷贝构造函数 会报错

  T& operator=(T&temp)=delete;

5/ 随机函数 rand()/  srand()

rand  stdilb.h 中

rand() 产生的是伪随机数,每次产生的是相同的值

如果想要产生不同的随机数用srand函数

srand((unsigned)time(0));

c++ learning note的更多相关文章

  1. Learning note for Binding and validation

    Summary of my learning note for WPF Binding Binding to DataSet. when we want to add new record, we s ...

  2. Learning Note: SQL Server VS Oracle–Database architecture

     http://www.sqlpanda.com/2013/07/learning-note-sql-server-vs.html This is my learning note base on t ...

  3. Course Machine Learning Note

    Machine Learning Note Introduction Introduction What is Machine Learning? Two definitions of Machine ...

  4. shell learning note

      shell learning note MAIN="/usr/local/" # 变量大写 STATUS="$MAIN/status" # 美元符加字符串是 ...

  5. 2014/09/30 Learning Note

    Vbird Linux: Vim Learning: http://linux.vbird.org/linux_basic/0310vi.php Bash Shell: http://linux.vb ...

  6. [Angular2] @Ngrx/store and @Ngrx/effects learning note

    Just sharing the learning experience related to @ngrx/store and @ngrx/effects. In my personal opinio ...

  7. Machine Learning Note Phase 1( Done!)

    Machine Learning 这是第一份机器学习笔记,创建于2019年7月26日,完成于2019年8月2日. 该笔记包括如下部分: 引言(Introduction) 单变量线性回归(Linear ...

  8. Inheritance Learning Note

    好几天没来学习了,昨晚把继承的又整理了一下.想把整理后的东西发到hexo博客上来,却发现命令行又失效了.前几天明明是好的,这几天又没有进行任何操作,网上搜了一下也没有招到合适的解决办法,无奈只能重装了 ...

  9. Machine Learning Note

    [Andrew Ng NIPS2016演讲]<Nuts and Bolts of Applying Deep Learning (Andrew Ng) 中文详解:https://mp.weixi ...

  10. Java: some learning note for Java calssloader and Servlet

    1. Java Classloader 链接: https://en.wikipedia.org/wiki/Java_Classloader 摘要: The Java Classloader is a ...

随机推荐

  1. jQuery构造函数init参数分析(三)

    分析完了字符串情况剩下的就不多了. 5.参数selector是函数 这个就是很容易想到了,首先说一下dom加载.我们通常在head里面写脚本的时候需要等待文档加载在进行处理,js是这么写的 windo ...

  2. javascript --- javascript与DOM

    javascript与DOM: 我们来个例子,一个HTML里包含一段文本和一个无序的列表. <p id="intro">My first paragraph...< ...

  3. Snort - manual 笔记(一)

    Chapter 1 Snort Overview This manual is based on Writing Snort Rules by Martin Roesch and further wo ...

  4. javascript 中 !~ 什么意思

    快过年放假了,也终于闲下来了.每天游览于各种技术文章中,这种状态好极了.下午看篇关于js的文章,其中有如下这么一段引起了我的注意. (function () { var names = []; ret ...

  5. Sharepoint学习笔记—习题系列--70-576习题解析 -(Q32-Q35)

    Question 32 You are designing the modification of an existing SharePoint 2010 intranet site for a sc ...

  6. JavaBean的作用域

    JavaBean的作用域 scope属性决定了JavaBean对象存在的范围. scope的可选值包括四种: page(默认值) request session application 这四个值对应的 ...

  7. [转]Android逆向之动态调试总结

    一.在SO中关键函数上下断点 刚学逆向调试时.大多都满足于在SO中某关键函数上下断点.然后通过操作应用程序,去触发这个断点,然后进行调试 详细的步骤可以参见非虫大大的<Android软件安全与逆 ...

  8. NSFileHandle

    /* 文件处理句柄要完成的工作:  相当于C中的文件操作,诸如 打开,读,写,关闭,修改文件偏移量等行为 类名:   NSFileHandle 注意: 操作句柄时,重点把握文件的偏移量在哪个位置 重点 ...

  9. 转载文章----C#基础概念

    转载地址:http://www.cnblogs.com/zhouzhou-aspnet/articles/2591596.html 1.值类型和引用类型 1.1堆和栈 简单的说值类型存放在堆栈上面,引 ...

  10. JQuery+ajax+jsonp 跨域访问

    Jsonp(JSON with Padding)是资料格式 json 的一种“使用模式”,可以让网页从别的网域获取资料. 关于Jsonp更详细的资料请参考http://baike.baidu.com/ ...