当前位置:编程学习 > C#/ASP.NET >>

为什么FindItem(aa,0)++;这一步报错???怎么才能更改这个值呢??

--------------------编程问答-------------------- Help!!!!


--------------------编程问答-------------------- --------------------编程问答--------------------
#include "stdafx.h"
#include "list"
using namespace std;

int FindItem(list<int> li,int n)
{
int temp=0;
typedef list<int> TypeList;
TypeList::iterator iter;
for(iter=li.begin();iter!=li.end();++iter)
{
if(n==temp)
return *iter;
temp++;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
list<int> aa;
aa.push_back(1);
aa.push_back(2);

int Index = 0;
int answer=FindItem(aa,Index++);
FindItem(aa,Index++); return 0;
}
--------------------编程问答-------------------- 注意看:

#include "stdafx.h"
#include "list"
using namespace std;

int FindItem(list<int> li,int n)
{
int temp=0;
typedef list<int> TypeList;
TypeList::iterator iter;
for(iter=li.begin();iter!=li.end();++iter)
{
if(n==temp)
return *iter;
temp++;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
list<int> aa;
aa.push_back(1);
aa.push_back(2);

int Index = 0;
int answer=FindItem(aa,Index++);
FindItem(aa,Index++);
return 0;
}
--------------------编程问答--------------------
补充:.NET技术 ,  VC.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,