小北


私信TA

用户名:pfb

访问量:1087

签 名:

星辰大海

等  级
排  名 9492
经  验 1094
参赛次数 0
文章发表 6
年  龄 19
在职情况 学生
学  校 泉州信息工程学院
专  业 电子信息工程

  自我简介:

解题思路:

注意事项:

参考代码:

#include<stdio.h>
#include<stdlib.h>
struct book
{
	char name[9];
	float tw;
	int ks;
	struct book *next;
 }; 
 typedef struct book like;
int main()
{
	int m,i=0;
    like *h,*t,*q,*p;
	h=q=NULL;
	h=(like*)malloc(sizeof(like));
	q=h;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	{
		t=(like*)malloc(sizeof(like));
		scanf("%s %f %d",t->name,&t->tw,&t->ks);
	
		q->next=t;
		q=t;
		q->next=NULL;
	}
	
	p=h->next;
	while(p)
	{
		if(p->tw>=37.5&&p->ks==1)
		{
		printf("%s\n",p->name);
		i++;
		}
		p=p->next;
	}
	printf("%d\n",i);
	return 0;
}


 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区