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. 【今日推荐】移动 Web 开发的10个最佳 JavaScript 框架

    选择正确的 JavaScript 框架,对于开发移动 Web 应用程序是至关重要的,也是移动应用程序开发的一项重要任务.开发人员可以使用框架实现的功能高效地达到他们的开发目标.这些预实现的组件采用优秀 ...

  2. Flex Viewer

    一.Flex Viewer简介 Flex Viewer是ESRI公司推出的可以高效开发基于WEB的地理信息应用系统的一种完全免费的应用程序框架.业务人员使用该框架可以无需任何额外的编程就能够通过简单配 ...

  3. User Profile Service Application 配置同步连接时,报 MOSS MA not found

    最近在试着配置"我的网站",不知什么原因在配置同步连接时报:MOSS MA not found 搜索发现,需要启动Forefront Identity Manager Servic ...

  4. datagridview的数据存取

    这里主要是复习DataSet等数据或ADO.NET方面的知识.下面是一个简单的数据存储(在DataGridView上增加一行然后并存储到数据库的过程): private void button1_Cl ...

  5. SharePoint Server 2016 Update

    Today’s post was written by Seth Patton, senior director of product management for the SharePoint te ...

  6. Core Animation - 核心动画

    CAAnimation类,是一个抽象类.遵循CAMediaTiming协议和CAAction协议! CAMediaTiming协议 可以调整时间,包括持续时间,速度,重复次数. CAAction协议  ...

  7. [Android]AndroidInject增加sqlite3数据库映射注解(ORM)

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/3623050.html AndroidInject项目是我写的一 ...

  8. OC中UITabBarController控制器

    UITabBarController UITabBarController(记为O)常用于管理多个导航控制器,例如有ABC三个导航控制器,可以:addChildViewController(记为A), ...

  9. Newtonsoft.Json 通过 JObject 读取 json对像 超简单

    /* json 格式的字符串解析 格式化 { "input": { "size": 193156, "type": "image/ ...

  10. 如何利用Pre.im分发iOS测试包

    大众创新万众创业,在移动互联网的风口,移动APP开发与测试发展方兴未艾,受到了越来越多的重视.相较 iOS,Android 的开发环境更加开放.Android 开发者要测试应用时,只需发个 APK 安 ...