鱼C论坛

 找回密码
 立即注册
查看: 3915|回复: 1

c++容器的问题

[复制链接]
发表于 2012-9-9 19:03:42 | 显示全部楼层 |阅读模式
1鱼币
#include <vector>
#include <iostream>

int main(void)
{

    std::vector <std::string> a(3);
    std::cout<<"please input string:"<<std::endl;
    for(std::vector <std::string>::size_type i;i!=a.size();i++)
    {
        std::cin>>a[i];
    }
    std::cout<<a[1]<<std::endl;
    return 0;
}
这个代码错了,怎么想容器的字符串写入啊????

小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-9-9 19:13:31 | 显示全部楼层
好吧~我2B了。。。。。。i没有赋值。。。。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-15 02:11

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表