编辑代码

#include <stdio.h>
struct studenttype{
	char sno[10];
	char name[10];
	double foreign,spec1,spec2;
}; 

int main(){
	struct studenttype stu;
	double sum;
	printf("考号");
	scanf("%s",stu.sno);
	printf("姓名");
	scanf("%s",stu.name);
	printf("外国语成绩");
	scanf("%lf",&stu.foreign);
	printf("专业课一成绩") ;
	scanf("%lf",&stu.spec1);
	printf("专业课二成绩");
    scanf("%lf",&stu.spec2);
    sum=stu.foreign+stu.spec1+stu.spec2;
    printf("%s的总成绩为%5.1lf",stu.name,sum);
    return 0;
	}