在C语言数据结构与算法中,怎么改正下列代码? #include<stdio.h> #include

在C语言数据结构与算法中,怎么改正下列代码?
#include<stdio.h>
#include<malloc.h>
typedef struct student
{
int number;
struct student* next;
}Node,*List;
void init(List w)
{
w=(List)malloc(sizeof(Node));
if(!w)
return;
w->next=NULL;
// w->next->number=0;
// w->next->next=NULL;
}
void shuru_list(List list)
{
int a;
getchar(a);
List b;
b=list->next;
while(a!=9)
{
List c;
c=(List)malloc(sizeof(Node));
c->number=a;
c->next=b->next;
b->next=c; //
getchar(a);
}
}
/*void print(List t)
{
List b;
b=t->next;
while(b->next!=NULL)
{
printf("%d ",b->number);
b=b->next;
}
printf("%d ",b->number);
printf("\n");
}*/
int main()
{
List list1;
init(list1);
shuru_list(list1);
// print(list1);
return 0;
}

#include//包含输入输出头文件#include//包含数学函数头文件voidmain()//定义主函数,void表示无返回值{floata,b;//定义两个浮点变量,a和bprintf("\ninputa:");//输出inputa到屏幕,\n表示换行scanf("%f,&a");//从键盘输入一个浮点类型的数,赋值给a变量printf("\ninputb:");//输出……scanf("%f",&b:);//读入……printf("\ninputc:");//BestRegards,这个是你加上去的吧,要删掉//BestRegards,//BestRegards,要注释掉scanf("%c",&c);//从键盘读入一个字符printf("n%c",c);//这个输出好像是多余的swithch(c)选择菜单{//少了一个花括号case'+':printf("a+b=%f",a+b);break;//当C的值为+时,输出a+b的值到屏幕case'-`:printf("a-b=%f",a-b);break;//减,case后必须有break,否则会继续执行下面的语句case'*':printf("a*b=%f",a*b);break;//乘case'/':printf("a/b=%f",a/b);break;//除default:break;}}//这个程序是做一个简单的加减乘除计算器,但我觉得把b作为运算符号比较符合人类的使用习惯
温馨提示:答案为网友推荐,仅供参考
相似回答