#include<stdio.h> #include<conio.h> struct SinhVien { char Hovaten[30],MSSV[10],Ngaysinh[10]; float diemtoan,diemanhvan; }; struct Thongtinmonhoc { //Mã môn, Tên môn, Số tín chỉ, Điểm. char Mamon[10],Tenmon[10]; int Sotinchi; float diem; }; void nhapthongtinmonhoc(Thongtinmonhoc &x) { fflush(stdin); printf("\nNhap Ten Mon Hoc: "); gets(x.Tenmon); fflush(stdin); printf("\nNhap Ma Mon Hoc: "); gets(x.Mamon); printf("\nNhap so tinh chi: "); scanf("%d",&x.Sotinchi); printf("\nNhap diem: "); scanf("%f",&x.diem); } void xuatthongtinmonhoc(Thongtinmonhoc x) { printf("\nTen Mon Hoc: %s",x.Tenmon); printf("\nMa Mon Hoc: %s",x.Mamon); printf("\nSo Tinh Chi: %d",x.Sotinchi); printf("\nDiem: %.2f",x.diem); } void nhapdulieuHS(SinhVien a[],int &n) { for(int i=0;i<n;i++) { printf("\n------------------------------------\n"); fflush(stdin); printf("\nNhap Ho Va Ten SV: "); gets(a[i].Hovaten); fflush(stdin); printf("\nNhap MSSV: "); gets(a[i].MSSV); fflush(stdin); printf("\nNhap ngay sinh: "); gets(a[i].Ngaysinh); printf("\nNhap diem toan: "); scanf("%f",&a[i].diemtoan); printf("\nNhap diem anh van: "); scanf("%f",&a[i].diemanhvan); } } void xuatdulieuHS(SinhVien a[],int n) { for(int i=0;i<n;i++) { printf("\n------------------------------------\n"); printf("\nHo va ten: %s",a[i].Hovaten); printf("\nMSSV: %s",a[i].MSSV); printf("\nNgay sinh: %s",a[i].Ngaysinh); printf("\nDiem toan: %0.1f",a[i].diemtoan); printf("\nDiem anh van: %0.1f",a[i].diemanhvan); printf("\n------------------------------------\n"); } } void main() { int n; Thongtinmonhoc x; SinhVien a[100]; printf("\nNhap so luong SV: "); scanf("%d",&n); nhapdulieuHS(a,n); xuatdulieuHS(a,n); nhapthongtinmonhoc(x); xuatthongtinmonhoc(x); getch(); }