【已解决】求助:C++编译错误,不知道怎么办啊,谢谢了
求助:编译错误,不知道怎么办啊,谢谢了源代码:头文件:ListStruct.h
typedef float DataType; //假设结点的数据类型是字符型
typedef struct node { //结点类型定义
DataType data;
struct node *next;//结点的指针域
}ListNode;
typedef ListNode * LinkList;
ListStruct.cpp
#include "iostream.h"
#include "string"
#include "ListStruct.h"
LinkList CreatList (float ch)
{ //用尾插法建立带头结点的单链表
LinkList head = (LinkList)malloc(sizeof( ListNode)); //生成头结点
ListNode *s , *r;
r=head;//尾指针亦指向头结点
s=(ListNode *) malloc (sizeof(ListNode));
s->data=ch;
r->next=s;
r=s;
r->next=NULL;
return head;
}
void OutList( LinkList L)
{
ListNode *p;
p=L;
while (p->next)
{
cout << p->next->data << " " ;
p=p->next;
}
cout << endl;
}
int main()
{
LinkList A;
cout<<"输入高程:"<<" ";
float er;
cin>>er;
CreatList (er);
return 0;
}
编译错误:
编译器: Default compiler
执行 g++.exe...
g++.exe "E:\Program Files\新建文件夹\ListStruct.cpp" -o "E:\Program Files\新建文件夹\ListStruct.exe" -I"d:\Dev-Cpp\include\c++" -I"d:\Dev-Cpp\include\c++\mingw32" -I"d:\Dev-Cpp\include\c++\backward" -I"d:\Dev-Cpp\include" -L"d:\Dev-Cpp\lib"
In file included from d:/Dev-Cpp/include/c++/backward/iostream.h:31,
from E:/Program Files/新建文件夹/ListStruct.cpp:1:
d:/Dev-Cpp/include/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
E:/Program Files/新建文件夹/ListStruct.cpp: In function..`ListNode*
CreatList(float)':
E:/Program Files/新建文件夹/ListStruct.cpp:13: warning: assignment to `DataType
' from `float'
E:/Program Files/新建文件夹/ListStruct.cpp:13: warning: argument to `char' from
`float'
E:/Program Files/新建文件夹/ListStruct.cpp: In function..`int main()':
E:/Program Files/新建文件夹/ListStruct.cpp:36: stray '\243' in program
E:/Program Files/新建文件夹/ListStruct.cpp:36: stray '\273' in program
E:/Program Files/新建文件夹/ListStruct.cpp:37: parse error before `>>' token
执行结束
我怎么也改不过来了
求助啊
先谢谢大家了yi
[[italic] 本帖最后由 wfjt 于 2007-11-30 16:42 编辑 [/italic]]