#include <stdio.h>
void main()
{
struct student
{
char name[10];
char sex;
int age;
float score;
}stu[5];
printf("please enter name,sex,age,score for student\n");
for (int i = 0; i < 5; i++)
{
scanf("%s,%c,%d,%f", stu[i].name, &stu[i].sex, &stu[i].age, &stu[i].score);
}
printf("输出信息\n");
for (int i = 0; i < 5; i++)
{
if (stu[i].sex == 'f')
printf("%s\t%d\t%4.1f\n", stu[i].name, stu[i].age, stu[i].score);
}
}
最后一个for循环怎么不执行?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
5条回答 默认 最新
- m0_66498354 2022-02-24 11:31关注
#include <stdio.h> void main() { struct student { char *name[10]; char xx[1];//////打印时用作间隔、、、、、 char sex; int age; float score; }stu[2]; printf("please enter name,sex,age,score for student\n"); for (int i = 0; i < 2; i++) { scanf("%s %c %d %f", stu[i].name, &stu[i].sex, &stu[i].age, &stu[i].score); } printf("输出信息\n"); for (int i = 0; i < 2; i++) { if (stu[i].sex == 'f') printf("%s\t%d\t%4.1f\n", stu[i].name, stu[i].age, stu[i].score); } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥60 求一个简单的网页(标签-安全|关键词-上传)
- ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
- ¥15 基于卷积神经网络的声纹识别
- ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
- ¥100 为什么这个恒流源电路不能恒流?
- ¥15 有偿求跨组件数据流路径图
- ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
- ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
- ¥15 CSAPPattacklab
- ¥15 一直显示正在等待HID—ISP