| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 1163 人关注过本帖
标题:编译不通过不知哪里出了问题 请大佬们请指点迷津
取消只看楼主 加入收藏
风流泰
Rank: 1
等 级:新手上路
帖 子:78
专家分:0
注 册:2018-9-29
结帖率:87.88%
收藏
已结贴  问题点数:6 回复次数:0 
编译不通过不知哪里出了问题 请大佬们请指点迷津
//编写程序获取vector容器的第一个元素,分别使用下标操作符,front函数以及begin函数实现该功能,并提供空的vector容器测试你的程序
#include<iostream>
#include<vector>
using namespace std;
int main(void)
{
    cout<<"\tInput some int numbers to a vector(Ctrl+Z to end):"<<endl;
    vector<int> ivec;
    int i;
    while(cin>>i)
    {
        ivec.push_back(i);
    }
    if(!ivec.empty())
    {
        cout<<"The first elements of the vector is:";
        cout<<"\n\t==>>Using front():\t"<<ivec.front();
        cout<<"\n\t==>>Using begin():\t"<<ivec.begin();
        cout<<"\n\t==>>Using ivec[0]:\t"<<ivec[0];
        cout<<"\n\t==>>Using ivec.at(0):\t"<<ivec.at(0)<<endl;
    }
    system("pause");
    return 0;
}
2019-04-18 13:44
快速回复:编译不通过不知哪里出了问题 请大佬们请指点迷津
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013539 second(s), 9 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved