| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 496 人关注过本帖
标题:superman gives me help
只看楼主 加入收藏
迢迢菜
Rank: 2
等 级:新手上路
威 望:4
帖 子:11
专家分:0
注 册:2014-2-26
结帖率:33.33%
收藏
 问题点数:0 回复次数:1 
superman gives me help
输入多项式的系数与指数
#include<stdio.h>
#include<malloc.h>
#define null 0
typedef struct node{
float coef;
int exp;
struct node *next;
}polynode;
polynode* creatpolyn(polynode *L)
{
    polynode *head,*p,*s;
    int m,i;
    head=(polynode*)malloc(sizeof(polynode));
    head->exp=-1;
    head->next=null;
    p=head;
    printf("多项式的项的个数m:");
    scanf("%d",&m);
    printf("请以(系数,指数)方式依次输入\n");
    for(i=1;i<=m;i++)
    {s=(polynode*)malloc(sizeof(polynode));
     scanf("(%f,%d)",&s->coef,&s->exp);
     p->next=s;
     p=s;
    }
    p->next=null;
    return (head);
}
int main()
{
    polynode *L,*l;
    L=creatpolyn(L);
    l=L->next;
    printf("%fx(%d)",l->coef,l->exp);
    l=l->next;
    while(l!=null){
        printf("+%fx(%d)",(l++)->coef,(l++)->exp);
    }
}
没语法错误,怎么运行时就是出问题
搜索更多相关主题的帖子: superman include 多项式 null 
2014-04-02 19:56
迢迢菜
Rank: 2
等 级:新手上路
威 望:4
帖 子:11
专家分:0
注 册:2014-2-26
收藏
得分:0 
就是无法创建一个链表
2014-04-02 23:11
快速回复:superman gives me help
数据加载中...
 
   



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

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