摘要: //在()函数返回一个参考指数禄字符串中的元素。//在()函数比[]操作更安全,因为它不会让你以外的字符串的界限的参考项目。#include <iostream>#include <vector>using namespace std;int main(){ vector<int> v(5,1); //这里访问访问到地址以外的数据信息 /*for(int i=0; i<10; i++){ cout<<"Element "<<i<<" is "<<v[i]<&l 阅读全文
posted @ 2012-02-15 22:53 简单--生活 阅读(156) 评论(0) 推荐(0) 编辑
摘要: //用DateMid_New类做界面 ^-^有点不够意思了,这个都还写出来有点错,自己还差点找不到#include "datemid_new.h"#include <iostream>int main(){ DateMid_New d(2005,9,9), e(42211); std::cout<<d; std::cout<<++d<<e; system("pause"); return 0;} //DateMid_New作为应用程序界面#ifndef HEADER_DATEMID_NEW#define H 阅读全文
posted @ 2012-02-15 22:18 简单--生活 阅读(238) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>using namespace std;void assign(){ string str="assign"; char str_one='i'; cout<<"size_type num, const char& val\n"; //添加指定数量的字符到str中去 str.assign(6,str_one); cout<<str<<endl; //添加字符串到str中去 string str_two 阅读全文
posted @ 2012-02-15 13:53 简单--生活 阅读(256) 评论(0) 推荐(1) 编辑
摘要: //append一共有六种重载类型#include <iostream>#include <string>using namespace std;void append(string& str, int number, char& s){ //cout<<str<<endl; //操把这里的类型弄错了,s只能是只能是字符而不能是string串 str.append(number,s); cout<<str<<endl; //str.append(number,s); string str_one=" 阅读全文
posted @ 2012-02-15 12:25 简单--生活 阅读(402) 评论(0) 推荐(0) 编辑
简单--生活(CSDN)