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. 网页引用本地电脑的字体 css设置浏览器会不显示的解决办法

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. Sharepoint学习笔记—习题系列--70-576习题解析 -(Q4-Q5)

    Question 4 You are designing a SharePoint 2010 application to store 50 GB of digital assets, includi ...

  3. iOS开发-canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"

    转载自:http://www.jianshu.com/p/e38a609f786e

  4. Kotlin:Android世界的Swift

    转自:http://www.infoq.com/cn/news/2015/06/Android-JVM-JetBrains-Kotlin Kotlin是一门与Swift类似的静态类型JVM语言,由Je ...

  5. Android 手机卫士--自定义组合控件构件布局结构

    由于设置中心条目中的布局都很类似,所以可以考虑使用自定义组合控件来简化实现 本文地址:http://www.cnblogs.com/wuyudong/p/5909043.html,转载请注明源地址. ...

  6. iOS 获取设备版本型号

    #import "sys/utsname.h" /** *  设备版本 * *  @return e.g. iPhone 5S */+ (NSString*)deviceVersi ...

  7. 【代码笔记】iOS-看图听声音

    一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> #import <AVFoundation/AVFo ...

  8. socket编程listen函数限制连接数的解决方案

    函数原型: int listen(int sockfd, int backlog); 当服务器编程时,经常需要限制客户端的连接个数,下面为问题分析以及解决办法: 下面只讨论TCP  UDP不做讨论(很 ...

  9. iOS-UIScrollView和UIPageControl的综合实力,滚动图,轮播图

    本代码主要实现图片之间的切换 目录结构 代码 ViewController.m文件 #import "ViewController.h" @interface ViewContro ...

  10. ios git 终端提交

    git status    //检查提交状态 git status On branch master  //检查分支 git branch   //查看分支 git add *   //添加所有本地更 ...