| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 696 人关注过本帖
标题:求助:编译错误,不知道怎么办啊,谢谢了
只看楼主 加入收藏
wfjt
Rank: 1
等 级:新手上路
帖 子:121
专家分:0
注 册:2007-11-30
收藏
 问题点数:0 回复次数:2 
求助:编译错误,不知道怎么办啊,谢谢了
源代码:
头文件: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
jingru
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-11-16
收藏
得分:0 
比较容易看出来的问题是:
int main()   里面要补全 int argc, char * argv[]
include <iostream.h> 不能用“”代替
2007-11-30 11:52
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
快速回复:求助:编译错误,不知道怎么办啊,谢谢了
数据加载中...
 
   



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

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