C语言题目(3题)
答案:1 悬赏:0 手机版
解决时间 2021-11-10 08:59
- 提问者网友:浮克旳回音
- 2021-11-09 15:47
C语言题目(3题)
最佳答案
- 五星知识达人网友:長槍戰八方
- 2021-11-09 17:15
#include
struct data
{
int n;
float s[10];
}
;
void fun(struct data *p)
{
int i,j;
float t;
for (i=1;in-1;++i) for (j=i+1;jn;++j) if(p->s[i]>p->s[j])
{
t=p->s[i];
p->s[i]=p->s[j];
p->s[j]=t;
}
}
void main()
{
int i;
struct data a={5,{3.6,0.5,5.0,10.3,6.8}};
fun(&a);
for (i=1;i printf("
");
}#include
#include
#define N 5
struct counter
{
char name[20];
int sum;
}
;
void main()
{
struct counter vote[N]={"Wang",0,"Li",0,"Zhao",0,"Sun",0,"Zhou",0};
char name[20];
int i;
printf("请输入候选人姓名[0结束]:
");
while(1)
{
gets(name);
if(strcmp(name,"0")==0) break;
for (i=0;i }
printf("各位候选人得票数:
");
for (i=0;i
",vote[i].name,vote[i].sum);
}
struct data
{
int n;
float s[10];
}
;
void fun(struct data *p)
{
int i,j;
float t;
for (i=1;i
{
t=p->s[i];
p->s[i]=p->s[j];
p->s[j]=t;
}
}
void main()
{
int i;
struct data a={5,{3.6,0.5,5.0,10.3,6.8}};
fun(&a);
for (i=1;i printf("
");
}#include
#include
#define N 5
struct counter
{
char name[20];
int sum;
}
;
void main()
{
struct counter vote[N]={"Wang",0,"Li",0,"Zhao",0,"Sun",0,"Zhou",0};
char name[20];
int i;
printf("请输入候选人姓名[0结束]:
");
while(1)
{
gets(name);
if(strcmp(name,"0")==0) break;
for (i=0;i
printf("各位候选人得票数:
");
for (i=0;i
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯