能把汇编语言源程序翻译成目标的程序称为
2个回答
推荐于2018-04-14 · 知道合伙人互联网行家
关注
展开全部
#include"stdio.h"
#include"malloc.h"
#define LEN sizeof(struct student)
struct student
{
long int num;
float score;
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int n=0;
p2=p1=(struct student*)malloc(LEN);
printf("请输入学号和成绩: \n");
scanf("%ld%f",&p1->num,&p1->score);
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
printf("请输入学号和成绩: \n");
scanf("%ld%f",&p1->num,&p1->score);
}
p2->next=NULL;
return(head);
}
void main()
{
struct student a,b,c;
struct student *head,*p,*result;
a.num=99101;a.score=89.5;
b.num=99103;b.score=90;
c.num=99107;c.score=85;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{
printf("%ld%5.lf\n",p->num,p->score);
p=p->next;
}
while(p!=NULL);
result = creat();
do
{
printf("%ld%5.lf\n",result->num,result->score);
result=result->next;
}
while(result!=NULL);
}
#include"malloc.h"
#define LEN sizeof(struct student)
struct student
{
long int num;
float score;
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int n=0;
p2=p1=(struct student*)malloc(LEN);
printf("请输入学号和成绩: \n");
scanf("%ld%f",&p1->num,&p1->score);
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
printf("请输入学号和成绩: \n");
scanf("%ld%f",&p1->num,&p1->score);
}
p2->next=NULL;
return(head);
}
void main()
{
struct student a,b,c;
struct student *head,*p,*result;
a.num=99101;a.score=89.5;
b.num=99103;b.score=90;
c.num=99107;c.score=85;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{
printf("%ld%5.lf\n",p->num,p->score);
p=p->next;
}
while(p!=NULL);
result = creat();
do
{
printf("%ld%5.lf\n",result->num,result->score);
result=result->next;
}
while(result!=NULL);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询