主题:大哥们帮忙看下是什么问题!谢谢大家了
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int> v;
for(int i=0;i <10;i++)
v.push_back(i);
for(int i=0;i <v.size();i++) //p108页
cout<<v[i]<<",";
cout<<endl;
for(int i=0;i <v.size();i++)
v[i]=v[i]*10;
for(int i=0;i <v.size();i++)
cout<<v[i]<<",";
cout<<endl;
}
出现的问题!
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(11) : error C2374: 'i' : redefinition; multiple initialization
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(9) : see declaration of 'i'
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(14) : error C2374: 'i' : redefinition; multiple initialization
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(9) : see declaration of 'i'
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(16) : error C2374: 'i' : redefinition; multiple initialization
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(9) : see declaration of 'i'
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(19) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
#include<vector>
using namespace std;
int main()
{
vector<int> v;
for(int i=0;i <10;i++)
v.push_back(i);
for(int i=0;i <v.size();i++) //p108页
cout<<v[i]<<",";
cout<<endl;
for(int i=0;i <v.size();i++)
v[i]=v[i]*10;
for(int i=0;i <v.size();i++)
cout<<v[i]<<",";
cout<<endl;
}
出现的问题!
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(11) : error C2374: 'i' : redefinition; multiple initialization
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(9) : see declaration of 'i'
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(14) : error C2374: 'i' : redefinition; multiple initialization
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(9) : see declaration of 'i'
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(16) : error C2374: 'i' : redefinition; multiple initialization
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(9) : see declaration of 'i'
C:\Documents and Settings\Administrator\桌面\有问题的C++程序\intvector.cpp(19) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.