Anybody could tell me what's wrong with the following code?
It complaints:
13 C:\apps\Dev-Cpp\projects\14\14_1.cpp ISO C++ forbids defining types within return type
Thanks in advance.
#include <iostream>
#include <cstdlib>
using namespace std;
struct vector {
double x;
double y;
friend ostream& operator<< (ostream&, vector);
}
ostream& operator<< (ostream& o, vector a) {
o << "(" << a.x << "," << a.y << ")" << endl;
return o;
}
int main(int argc, char *argv[])
{
vector v1;
v1.x = 1;
v1.y = 1;
cout << v1 << endl;
system("PAUSE");
return 0;
}
<< moderator edit: added
tags >>