|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void shuru(int *p1,int *p2,int *p3,long long int *x,char *xing[],int *n2,int *p,double *pi){//1
int n3=0,m;
printf("请输入您要登记的学生数目:");
scanf("%d",&m);
//system("cls");
for(n3=0;n3<m;n3++){
printf("%d\n",n3);
printf("请输入第%d位学生学号:",n3+1);
scanf("%lld",(x+*n2));
printf("\n请输入第%d位学生姓名:",n3+1);
scanf("%s",xing[*n2]);
printf("\n请输入第%d位学生语文成绩:",n3+1);
scanf("%d",(p1+*n2));
while(*(p1+*n2)>150){
if(*(p1+*n2)>150){
printf("输入错误,请重新开始\n");
printf("请输入第%d位学生语文成绩:",n3+1);
scanf("%d",(p1+*n2));
}
}
printf("\n请输入第%d位学生数学成绩:",n3+1);
scanf("%d", (p2+*n2));
while(*(p2+*n2)>150){
if(*(p2+*n2)>150){
printf("输入错误,请重新开始\n");
printf("请输入第%d位学生数学成绩:",n3+1);
scanf("%d",(p2+*n2));
}
}
printf("\n请输入第%d位学生英语成绩:",n3+1);
scanf("%d", (p3+*n2));
while(*(p3+*n2)>150){
if(*(p3+*n2)>150){
printf("输入错误,请重新开始\n");
printf("请输入第%d位学生语文成绩:",n3+1);
scanf("%d",(p3+*n2));
}
}
*(p+*n2)=*(p1+*n2)+*(p2+*n2)+*(p3+*n2);
printf("\n第%d位学生总成绩为:%d",n3+1,*(p+*n2));
*(pi+*n2) =(double)*(p+*n2)/3;
printf("\n第%d位学生平均成绩为:%f",n3+1,*(pi+*n2));
printf("\n");
printf("第%d位学生信息录入完毕!\n",*n2+1);
(*n2)++;
}//会莫名其妙地退出。!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return;
}
int main(){
int number=0,n1=0,n,*n2;//*n2用来表示总数;
n2 = &number;
double pb[100];
double *pi;
pi = pb;
long long int *x,xuehao[100];
int *p,*p1,*p2,*p3,b1[100],b2[100],b3[100];
int sum[100];
char xingming[100][10];
char *xing[100];
x = xuehao;
p = sum;
p1 = b1;
p2 = b2;
p3 = b3;
xing[0] = xingming[0];
do{
n=0;
printf("请选择您的操作:");
scanf("%d",&n);
p1 = b1;
p2 = b2;
p3 = b3;
printf("n = %d\n",n);
if(n==1){
shuru(p1,p2,p3,x,xing,n2,p,pi);
}
}while(n!=0);
return 0;
}
|
|