2014年10月23日

c++ ++i and i++

摘要: ++i 在 i 存储的值上增加一并向使用它的表达式 ``返回" 新的, 增加后的值; 而 i++ 对 i 增加一, 但返回原来的是未增加的值。至于++i和i++有什么区别,举个例子 1.a = i++; 等校为 a = i; i = i ... 阅读全文

posted @ 2014-10-23 18:58 蒂其之死 阅读(435) 评论(0) 推荐(0)

C++ string char[] 转化

摘要: 可见到string转char[]相当简单,只要呼叫string class的成员函式c_str(),即可将string转为char[]。那么char[]转string呢?有两种方法,第一种是初始string变数时,即把char[]当作参数来初始化,第二种则是使用string class的成员函式as... 阅读全文

posted @ 2014-10-23 18:48 蒂其之死 阅读(244) 评论(0) 推荐(0)

c++ 转化

摘要: atof(将字符串转换成浮点型数)相关函数atoi,atol,strtod,strtol,strtoul表头文件#include定义函数doubleatof(constchar*nptr);函数说明atof()会扫描参数nptr字符串,跳过前面的空格字符,直到遇上数字或正负符号才开始做转换,而再遇到... 阅读全文

posted @ 2014-10-23 18:45 蒂其之死 阅读(288) 评论(0) 推荐(0)

c++ stl

摘要: 1.listassign() 给list赋值back() 返回最后一个元素begin() 返回指向第一个元素的迭代器clear() 删除所有元素empty() 如果list是空的则返回trueend() 返回末尾的迭代器erase() 删除一个元素front() 返回第一个元素get_allocat... 阅读全文

posted @ 2014-10-23 18:05 蒂其之死 阅读(182) 评论(0) 推荐(0)

c++ int string互转

摘要: 1. if(i>str;string转intstd::string str = "123";int n = atoi(str.c_str());#include "stdafx.h"#include #include using namespace std;void main(){ //... 阅读全文

posted @ 2014-10-23 18:01 蒂其之死 阅读(222) 评论(0) 推荐(0)

c++ String去除头尾空格

摘要: 1.使用string的find_first_not_of,和find_last_not_of方法 1 #include 2 #include 3 4 std::string& trim(std::string &); 5 6 int main() 7 { 8 std::string... 阅读全文

posted @ 2014-10-23 09:35 蒂其之死 阅读(7530) 评论(0) 推荐(0)

导航