标题:求助:编译错误,不知道怎么办啊,谢谢了
取消只看楼主
wfjt
Rank: 1
等 级:新手上路
帖 子:121
专家分:0
注 册:2007-11-30
 问题点数:0 回复次数:1 
求助:编译错误,不知道怎么办啊,谢谢了
源代码:
头文件: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
执行结束


我怎么也改不过来了

求助啊
先谢谢大家了
搜索更多相关主题的帖子: 结点 源代码 LinkList ListNode 
2007-11-30 11:17
wfjt
Rank: 1
等 级:新手上路
帖 子:121
专家分:0
注 册:2007-11-30
得分: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 `int main(int,
   char**)':
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

执行结束
2007-11-30 15:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-189478-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.138159 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved