为了账号安全,请及时绑定邮箱和手机立即绑定

结构体中 怎么把volume=length*width*high;加入程序中?

#include<stdio.h>

struct student

{

int length,width,high,volume;

char name[8];

};//结构型定义结束一定要加分号

int main()

{

struct student stu[9];

int i,N,temp;

scanf("%d",&N);

for(i=0;i<N;i++)

scanf("%d%d%d%s",&stu[i].length,&stu[i].width,&stu[i].high,stu[i].name);

for(i=0;i<N;i++)

{

if(stu[i].volume>stu[i+1].volume)

{

temp=stu[i].volume;

stu[i].volume=stu[i+1].volume;

stu[i+1].volume=temp;

}

}

printf("%s took clay from %s\n",stu[N-1].name,stu[0].name);

return 0;

}


正在回答

2 回答

不是浏览器的问题,是调用谷歌的js库文件有问题

0 回复 有任何疑惑可以回复我~

#include<stdio.h>

struct student

{

int length,width,high,volume;

char name[8];

};//结构型定义结束一定要加分号

int main()

{

struct student stu[9];

int i,N,temp;

scanf("%d",&N);

for(i=0;i<N;i++)

scanf("%d%d%d%s",&stu[i].length,&stu[i].width,&stu[i].high,stu[i].name);

for(i=0;i<N;i++)

{

if(stu[i].volume>stu[i+1].volume)

{

temp=stu[i].volume=length*width*high;

stu[i].volume=stu[i+1].volume;

stu[i+1].volume=temp;

}

}

printf("%s took clay from %s\n",stu[N-1].name,stu[0].name);

return 0;

}


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
C语言入门
  • 参与学习       924485    人
  • 解答问题       20757    个

C语言入门视频教程,带你进入编程世界的必修课-C语言

进入课程

结构体中 怎么把volume=length*width*high;加入程序中?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信