tring_vector容器test
// 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相关推荐
- 阿里云K8S容器服务的使用
使用阿里云k8s构建服务 一. 上传镜像 二. k8s运行 三. 服务配置导入 四. 服务路由 五. 节点亲和性和污点管理 一. 上传镜像 在阿里云控制台找到"容器镜像服务",开启 ...
- Dockerfile springboot项目拿走即用,将yml配置文件从外部挂入容器
Dockerfile 将springboot项目jar包打成镜像,并将yml配置文件外挂. # 以一个镜像为基础,在其上进行定制.就像我们之前运行了一个 nginx 镜像的容器,再进行修改一样,基础镜 ...
- Docker容器的备份与恢复,Docker镜像的备份与恢复
1. 备份容器 首先,为了备份Docker中的容器,我们会想看看我们想要备份的容器列表.要达成该目的,我们需要在我们运行着Docker引擎,并已创建了容器的Linux机器中运行 docker ps 命 ...
- 使用rancher对Docker容器服务升级
这是笔者以前使用到的一个docker管理工具--rancher 升级服务的步骤 记录一下,说不定有人需要或者以后能用上呢? 1.打包好后上传服务器,编写Dockerfile FROM jdk8apli ...
- docker停止、删除容器、删除镜像 一看就理解
当你的容器中出现问题(比如我改坏了文件)需要重新部署一台的时候,就需要将这个容器实例删除 接着: #查看当前的容器ID $ docker ps 这里你会看到有两列id,一列是镜像id,一列是容器id, ...
- 【Docker】容器的几种网络模式
当你使用Docker时,你会发现需要了解很多关于网络的知识.Docker作为目前最火的轻量级容器引擎,因此,我们有必要深入了解Docker的网络知识,以满足更高的网络需求.本文介绍了Docker的4种 ...
- docker 容器访问宿主机的解决方式
需求 基于本地docker的自研及使用需要,希望docker容器的服务能连接到宿主机提供的服务. 背景 网络上查阅了大量的资料,基本的解决办法是通过手动查阅IP的方式进行, 但docker宿主机的ip ...
- Docker入门六部曲——容器
原文链接:http://www.dubby.cn/detail.html?id=8734 准备 已经安装好Docker 1.13或者以上的版本. 读完的上一篇文章(基本引导). 简单的测试一下你的本地 ...
- Spring cloud 微服务docker容器化最佳实践
Spring cloud 是当下最炙手可热的微服务套件,我们将介绍如何整合Docker容器达到高效快捷的构建发布 采用了dockerfile-maven-plugin插件发布镜像到远程docker主机 ...
最新文章
- 廖雪峰JS教程学习记录---字符串
- 基于深度学习的步态识别算法的MATLAB仿真
- python load_Python实例:numpy.load()的使用
- 配置zabbix监控windows,cmd运行报错cannot connect to Service Manager: [0x00000005]
- git基础-远程仓库的使用
- HTML5 表单相关
- IE css HACK
- Linux学习笔记-项目部署01
- 设计模式-头脑风暴-速记
- ubuntu+网易云安装
- 给野生大熊猫当保镖,是种什么体验?
- 从零开始学习oracle(2) oracle11g的远程链接和数据库调试
- idea gradle GC overhead limit exceeded
- linux桌面lxde 安装_Archlinux LXDE 桌面环境安装配置
- 怎样设置计算机u盘启动程序,BIOS如何设置U盘为第一启动项
- 课后自主练习(排序)1027. 极坐标排序 easy《编程思维与实践》个人学习笔记
- vue中数据之间的传递用propos
- hive 窗口函数--常用函数介绍
- 高新技术企业申请容易吗?如何提高申报通过的机率?
- 基于javaweb的医药信息管理系统(java+ssm+html+easyui+mysql)