Quan Ly SV
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define max 100
typedef struct { char ho[10]; char tendem[20];char ten [10]; } hoten;
typedef struct {float toan; float ly; float hoa;} diem;
typedef struct {hoten HVT; char quequan[30]; char truong[50];
unsigned char tuoi; int SBD; diem diemthi;}
sinhvien;
void nhaphoten(hoten *HVT)
{ char st[20];
printf("
Ho : ");
fflush(stdin);
strcpy(HVT->ho,st);
printf("
Ten dem : ");
fflush(stdin);
strcpy(HVT->tendem,st);
printf("
Ten : ");
fflush(stdin);
strcpy(HVT->ten,st);
}
void nhapdiem(diem *d)
{ float temp;
printf("
Diem toan: ");
scanf("%f",&temp);
d->toan=temp;
printf("
Diem ly : ");
scanf("%f", &temp);
d->ly=temp;
printf("
Diem hoa : ");
scanf("%f", &temp);
d->hoa=temp;
}
void nhap(sinhvien ds[max],int *n)
{ char st1[30];
unsigned char t;
int sbd,i;
printf("nhap vao so thi sinh:");
scanf("%d",n);
for(i=0;i<*n;i++)
{ printf("nhap thong tin thi sinh %d:
",i+1);
printf(" ho va ten:
");
nhaphoten(&ds[i].HVT);
printf(" diem thi:
");
nhapdiem(&ds[i].diemthi);
printf("truong:
");
fflush(stdin);
gets(st1);
strcpy(ds[i].truong,st1);
printf(" que quan:
");
fflush(stdin);
gets(st1);
strcpy(ds[i].quequan,st1);
printf("tuoi:
");
scanf("%d",&t);
ds[i].tuoi=t;
printf("SBD:
");
scanf("%d",&sbd);
ds[i].SBD=sbd;
}
}
void main()
{ int n;
sinhvien dsts[max];
nhap(dsts,&n);
getch();
}
Bạn đang đọc truyện trên: AzTruyen.Top