// string_vector_test.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<iostream> // cout , endl etc
#include<string>
#include<vector>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
int i = 0;
cout << "Huoyanjun test!!!" << endl;
string str = "hello!!";
char tmp_c = '2';

cout << str <<endl;
str += "c";
cout << str << endl;
str += tmp_c;
cout << str << endl;
{
string shuzi_str_zheng = "123";
int tmp_int = atoi(shuzi_str_zheng.c_str());
printf("-->tmp_int:%d;-->shuzi_str_zheng.c_str():%s;\n", tmp_int, shuzi_str_zheng.c_str());
}

{
string shuzi_str_zheng = "-123";
int tmp_int = atoi(shuzi_str_zheng.c_str());
printf("-->tmp_int:%d;-->shuzi_str_zheng.c_str():%s;\n", tmp_int, shuzi_str_zheng.c_str());
}

{
string shuzi_str_zheng = "+123";
int tmp_int = atoi(shuzi_str_zheng.c_str());
printf("-->tmp_int:%d;-->shuzi_str_zheng.c_str():%s;\n", tmp_int, shuzi_str_zheng.c_str());
}
{
cout << "测试:"<< ++i << endl;
string shuzi_str_zheng = "+123";
int tmp_int = atoi(shuzi_str_zheng.c_str());
printf("-->shuzi_str_zheng.c_str():%s;-->tmp_int:%d;\n", shuzi_str_zheng.c_str(), tmp_int);

shuzi_str_zheng += '5';

tmp_int = atoi(shuzi_str_zheng.c_str());
printf("-->shuzi_str_zheng.c_str():%s;-->tmp_int:%d;\n", shuzi_str_zheng.c_str(), tmp_int);
}

{
cout << "测试:" << ++i << endl;
string shuzi_str_zheng = "+123A";
int tmp_int = atoi(shuzi_str_zheng.c_str());
printf("-->shuzi_str_zheng.c_str():%s;-->tmp_int:%d;\n", shuzi_str_zheng.c_str(), tmp_int);

shuzi_str_zheng += '5';

tmp_int = atoi(shuzi_str_zheng.c_str());
printf("-->shuzi_str_zheng.c_str():%s;-->tmp_int:%d;\n", shuzi_str_zheng.c_str(), tmp_int);
}

{
cout << "测试:" << ++i << endl;
int j = 0;
vector<int> vec;
int a = ++j;
vec.push_back(a);

a = ++j;
vec.push_back(a);

a = ++j;
vec.push_back(a);

a = ++j;
vec.push_back(a);

a = ++j;
vec.push_back(a);

cout << "vec size:" << vec.size() << endl;

vector<int>::iterator it;
for(it = vec.begin(); it != vec.end(); it++)

{
cout << *it << endl;
}

vec.insert(vec.begin(),0);

cout << "插入0后:" << endl;
for (it = vec.begin(); it != vec.end(); it++)

{
cout << *it << endl;
}

cout <<"删除1" << endl;
int idx = 0;
for (it = vec.begin(); it != vec.end(); it++, idx++)

{

cout << *it << endl;
if (1 == *it){
vec.erase(vec.begin() + idx);
cout << "删除1" << endl;
break;
}

}

cout << "删除1后遍历向量:" << endl;
for (it = vec.begin(); it != vec.end(); it++)

{
cout << *it << endl;
}

}

{
cout << "测试:" << ++i << endl;
int j = 0;
vector<double> vec;
double a = ++j + 3.1415926;
vec.push_back(a);

a = ++j + 3.1415926;
vec.push_back(a);

a = ++j + 3.1415926;
vec.push_back(a);

a = ++j + 3.1415926;
vec.push_back(a);

a = ++j + 3.1415926;
vec.push_back(a);

cout << "vec size:" << vec.size() << endl;

vector<double>::iterator it;
for (it = vec.begin(); it != vec.end(); it++)

{
cout << *it << endl;
}

}
return 0;
}

tring_vector容器test相关推荐

  1. 阿里云K8S容器服务的使用

    使用阿里云k8s构建服务 一. 上传镜像 二. k8s运行 三. 服务配置导入 四. 服务路由 五. 节点亲和性和污点管理 一. 上传镜像 在阿里云控制台找到"容器镜像服务",开启 ...

  2. Dockerfile springboot项目拿走即用,将yml配置文件从外部挂入容器

    Dockerfile 将springboot项目jar包打成镜像,并将yml配置文件外挂. # 以一个镜像为基础,在其上进行定制.就像我们之前运行了一个 nginx 镜像的容器,再进行修改一样,基础镜 ...

  3. Docker容器的备份与恢复,Docker镜像的备份与恢复

    1. 备份容器 首先,为了备份Docker中的容器,我们会想看看我们想要备份的容器列表.要达成该目的,我们需要在我们运行着Docker引擎,并已创建了容器的Linux机器中运行 docker ps 命 ...

  4. 使用rancher对Docker容器服务升级

    这是笔者以前使用到的一个docker管理工具--rancher 升级服务的步骤 记录一下,说不定有人需要或者以后能用上呢? 1.打包好后上传服务器,编写Dockerfile FROM jdk8apli ...

  5. docker停止、删除容器、删除镜像 一看就理解

    当你的容器中出现问题(比如我改坏了文件)需要重新部署一台的时候,就需要将这个容器实例删除 接着: #查看当前的容器ID $ docker ps 这里你会看到有两列id,一列是镜像id,一列是容器id, ...

  6. 【Docker】容器的几种网络模式

    当你使用Docker时,你会发现需要了解很多关于网络的知识.Docker作为目前最火的轻量级容器引擎,因此,我们有必要深入了解Docker的网络知识,以满足更高的网络需求.本文介绍了Docker的4种 ...

  7. docker 容器访问宿主机的解决方式

    需求 基于本地docker的自研及使用需要,希望docker容器的服务能连接到宿主机提供的服务. 背景 网络上查阅了大量的资料,基本的解决办法是通过手动查阅IP的方式进行, 但docker宿主机的ip ...

  8. Docker入门六部曲——容器

    原文链接:http://www.dubby.cn/detail.html?id=8734 准备 已经安装好Docker 1.13或者以上的版本. 读完的上一篇文章(基本引导). 简单的测试一下你的本地 ...

  9. Spring cloud 微服务docker容器化最佳实践

    Spring cloud 是当下最炙手可热的微服务套件,我们将介绍如何整合Docker容器达到高效快捷的构建发布 采用了dockerfile-maven-plugin插件发布镜像到远程docker主机 ...

最新文章

  1. 廖雪峰JS教程学习记录---字符串
  2. 基于深度学习的步态识别算法的MATLAB仿真
  3. python load_Python实例:numpy.load()的使用
  4. 配置zabbix监控windows,cmd运行报错cannot connect to Service Manager: [0x00000005]
  5. git基础-远程仓库的使用
  6. HTML5 表单相关
  7. IE css HACK
  8. Linux学习笔记-项目部署01
  9. 设计模式-头脑风暴-速记
  10. ubuntu+网易云安装
  11. 给野生大熊猫当保镖,是种什么体验?
  12. 从零开始学习oracle(2) oracle11g的远程链接和数据库调试
  13. idea gradle GC overhead limit exceeded
  14. linux桌面lxde 安装_Archlinux LXDE 桌面环境安装配置
  15. 怎样设置计算机u盘启动程序,BIOS如何设置U盘为第一启动项
  16. 课后自主练习(排序)1027. 极坐标排序 easy《编程思维与实践》个人学习笔记
  17. vue中数据之间的传递用propos
  18. hive 窗口函数--常用函数介绍
  19. 高新技术企业申请容易吗?如何提高申报通过的机率?
  20. 基于javaweb的医药信息管理系统(java+ssm+html+easyui+mysql)

热门文章

  1. Tkinter-疫苗信息管理系统
  2. 微信里的小程序怎么制作
  3. ganglia监控hadoop集群配置
  4. 万春布林和恒瑞医药达成深度战略合作;方达控股、基石药业、天演药业发布最新业绩 | 医药健闻...
  5. 中文拼音模糊查询的一种解决方法
  6. 将台式机组成云服务器_四种旧PC台式电脑改造桌面云虚拟化的方案介绍
  7. 个性篮球队名_你的篮球个性是什么
  8. c语言实现灰度图转换
  9. U²-Net:使用显著性物体检测来生成真实的铅笔肖像画
  10. 武汉大学计算机学院附近澡堂,武汉大学附近美食攻略