帮忙看下,为什么提示我函数没有定义。
#include <iostream>#include <string>
#include <iomanip>
#include <fstream>
#define TURE 1;
#define ERORR 0;
#define OK 1;
#define FALSE 0;
using namespace std;
class city
{ // 用类定义城市坐标
public:
char name;
float x; // 经度
float y; // 纬度
class city *next;
void inset(city *p);
void set(char n,float a,float b)
{
name=n;
x=a;
y=b;
}
};
void city::inset(city *p)
{
ofstream outfile("date.txt",ios::out);
if(!outfile)
{
cout<<"error"<<endl;
exit(1);
}
while(p->next!=NULL)
{
cout<<p->name<<" "<<p->x<<" "<<p->y;
outfile<<p->name<<" "<<p->x<<" "<<p->y;
}
outfile.close();
}
int main()
{
char name;
city c1,c2,c3;
city *head,*p,*q;
q=head=new city;
for(int i=0;i<3;i++)
{
p=new city;
cout<<"name";
cin>>p->name;
cout<<"a";
cin>>p->x;
cout<<"b";
cin>>p->y;
q->next=p;
q=q->next;
}
inset(head);
return 0;
}