关于C语言的问题

[复制链接]
查看11 | 回复1 | 2008-3-28 14:47:22 | 显示全部楼层 |阅读模式
#includetypedef struct student{char name[20];char num[20];float english;float math;float computer; }Stu; void main() {float ft;printf("Enter ft:");scanf("%f", &ft);float ct = (float)5*(ft-31)/9;printf("ct:%f\n",ct); Stu st[2];int i;for(i=0;i<2;++i){ printf("Enter (name num and score:endlish,math,computer):"); scanf("%s", &st.name); scanf("%s", &st.num); scanf("%f", &st.english); scanf("%f", &st.math); scanf("%f", &st.computer);}printf("%s, %s\n%s, %s\nenglish:%.2f\nmath:%.2f\ncomputer:%.2f\n",st[0].name,st[0].num,st[1].name,st[1].num,(st[0].english+st[1].english)/2,(st[0].math+st[1].math)/2,(st[0].computer+st[1].computer)/2); }
回复

使用道具 举报

千问 | 2008-3-28 14:47:22 | 显示全部楼层
1.#include "stdio.h"void main(){float ct,ft;printf("请输入ft");scanf("%f",&ft);ct=5.0/9(ft-32);}2.#include "stdio.h"void main(){float escore1,mscore1,cscore1,escore2,mscore2,cscore2;char[20] name1,name2;int num1,num2;folat ave1,ave2;ave1=escore1+mscore1+cscore1/3;ave2=escore2+mscore2+cscore2/3;printf("分别输入两个学生的姓名,学号,英语成绩,数学成绩和电脑成绩:\n");scanf("%s,%d,%f,%f,%f,,%s,%d,%f,%f,%f",&name1,&num1,&escore1,&mscore1,&cscore1,&name2,&num2,&escore2,&mscore2,&cscore2);printf("输入两个学生的名字,学号:\n");printf("%s,%s,%d,%d",name1,name2,num1,num2);printf("输出2个学生的平均分:\n");printf("%f,%f",ave1,ave2);}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行