0

Can someone help me find the error that keeps this prg from running
thanx

#include <iostream>

#include <vector>

using namespace std;

int main()
{
	vector<int>v(1,1);
	v.push_back(2);v.push_back(3);v.push_back(4);
	vector<int>::iterator i=v.begin();
	vector<int>::iterator j=i+2;cout<<*j<<"";
	i+=3;cout<<*i<<"";
	j=i-1;cout<<*j<<"";
	j-=2;
	cout<<*j<<"";
	cout<<v[1]<<endl;	//output 1

	(j<i)?cout<<"j<i":cout<<"not(j<i)";cout<<endl;	//output 2
	(j>i)?cout<<"j>i":cout<<"not(j>i)";cout<<endl;	//output 3

	i=j;
	i<=J&&j<=i?cout<<"i and j equal":cout<<"i and j not equal";cout<<endl;  //output 4
	j=v.begin();
	i=v.end();
	cout<<"iterator distance end - begin =^ size:"<<(i-j);  //output 5


	return 0;

}
2
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by Cherrio
0
i<=J&&j<=i?cout<<"i and j equal":cout<<"i and j not equal";cout<<endl; //output 4

Doesn't your compiler say something like this?

Undefined symbol 'J' in function main()

Which would make it easy to find this:

i<=[B]J[/B]&&j<=i?cout<<"i and j equal":cout<<"i and j not equal";cout<<endl; //output 4
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.