Latest topics | » [vnplay.org]MU Việt Season 6.3 - Reset Và Non Reset -Không Webshop - Open tháng 5 by 04/05/13, 03:21 pm
» CỘNG LIÊN TIẾP 2 PHẦN TỬ TRÊN DANH SÁCH LIÊN KẾT ĐƠN by 03/07/12, 07:41 pm
» Hack MU Bá Vương ss6.3 thế hệ Phục Hưng by 25/06/12, 11:45 pm
» Giáo Trình Ảnh cưới & Album cưới ấn tượng - (1 DVD) by 16/06/12, 07:59 pm
» Download SQL Server 2008 Enterprise Full + Crack by 24/05/12, 08:44 pm
» MU bavuong.vn ss6.3 open 11/3 by 11/03/12, 09:58 am
» Tell Me More English 10 [Full] hot hot đầy đủ các cấp độ-link mediafire by 27/02/12, 02:50 pm
» Game4V và Event "Viết bài hay, nhận ngay quà tặng" by 19/02/12, 09:10 pm
» [18+] 10 DVD Lovers Guide-Bí quyết hạnh phúc gia đình by 30/11/11, 05:31 am
» PIRATES II - Stagnetti Revenge - Việt Sub - Bản HD BluRay by 30/11/11, 05:24 am
» MU Truyền Kỳ Season 6.2 - Huyền thoại Atlans by 25/11/11, 08:31 am
» TRY.VN RA MẮT CỤM MÁY CHỦ MỚI : HOÀN MỸ - OPEN 22/11 - ĐỈNH CAO MU ONLINE by 23/11/11, 07:23 am
» MU 24 Giờ - Cực khó dành cho game thủ đích thực - Open Beta vào lúc 11h ngày 11/11/2011 by 19/11/11, 04:34 am
» hiệu ứng phim Adobe After Effects " KHO 1 " (1 DVD) link mediafre by 10/11/11, 10:54 pm
» Hướng dẫn cài đặt router modem ADSL - SaiGonLab by 11/10/11, 05:42 am
» Tell Me More English 10 [Full] hot hot đầy đủ các cấp độ-link mediafire by 22/09/11, 08:52 am
» hoi admin by 22/09/11, 08:48 am
» xin giup do ve van de virut by 20/09/11, 05:43 pm
» Study English - IELTS Preparation (ebook+2 Đĩa DVD) by 05/09/11, 11:48 pm
» AUTODESK MOTIONBUILDER 2011 English mediafire by 15/08/11, 10:59 am
» Acquista Viagra. viagra generico in farmacia kamagra jelly by 04/08/11, 06:53 pm
» Acquisto Viagra. catalogo viagra generico by 04/08/11, 09:24 am
» NEW ENGLISH FILE Series (Complete)| 2.16 GB Full 4 levels by 04/08/11, 08:23 am
» Acquista Viagra. prezzi farmacia viagra generico by 04/08/11, 07:35 am
» cat burglar cash slot by 03/08/11, 07:17 am
» fish oil weight loss by 03/08/11, 02:27 am
» вопрос врачу гинекологу вопрос врачу by 01/08/11, 01:39 pm
» This forum aid me thanks by 01/08/11, 06:58 am
» Tell Me More English V10 New by 30/07/11, 11:12 am
» Viagra Generico. venta comprar viagra by 30/07/11, 10:58 am
» Продвижение неизбежно by 30/07/11, 08:12 am
» Language In Use aka 24/7 English | 4.2 GB mediafre by 29/07/11, 05:08 pm
» Comprar Viagra Online. viagra en andorra sin receta by 29/07/11, 12:15 pm
» generic cialis online by 29/07/11, 09:43 am
» Viagra Sin Receta. viagra 50 mg by 29/07/11, 05:27 am
» Viagra Sin Receta. se puede comprar viagra sin receta medica by 28/07/11, 11:33 am
» Kiếm tiền online ( Uy tín ) tại Việt Nam by 28/07/11, 09:38 am
» Tiếng Anh online by 05/07/11, 10:37 am
» kiem tien online uy tin by 29/06/11, 11:12 am
» 80 VCD Học Tiếng Anh ENGLISH FOR YOU - INTERMEDIATE LEVELS - 20CD by 21/06/11, 03:54 pm
» [MU CỬU THIÊN] OPEN BETA LÚC 9:00 - Ngày 11/6/2011 by 11/06/11, 02:26 am
» CẤU TRÚC GIỮ LIỆU by 07/06/11, 07:35 am
» hiệu ứng phim Adobe After Effects " KHO 3 " (2 DVD) link mediafre by 25/05/11, 11:38 am
» Bộ Giáo Trình Dạy Làm Một Hacker by 01/05/11, 09:34 am
» "Dế" Android thắng trên thị trường smartphone Việt by 05/04/11, 11:21 am
» Giáo Trình Photoshop CS4 (2 DVD) by 18/03/11, 10:14 pm
» [Âm nhạc online] Ta mãi bên nhau by 18/03/11, 10:11 am
» Portable Adobe CS5 -tất cả các bản hãng ADOBE cs5-mediafire by 16/03/11, 12:45 pm
» hiệu ứng phim Adobe After Effects "KHO 2 " (2 DVD) link mediafre by 11/03/11, 09:30 am
» MU Độc Tôn SS 6.6 by 08/03/11, 06:00 pm
» Ghost Windows XP Service Pack 3 from MSDN compatible with all PC by 05/03/11, 12:09 pm
» Stock vector you need Pack 2 - 7,54 Gb[MF] by 01/03/11, 01:29 am
» AUTODESK MAYA 2011 WIN32 & WIN64 MF-RS-HF Links 1.25 GB for Win 32bit | 1.50 GB for Win 64bit by 20/02/11, 03:51 pm
» MBooK Ngành 3D, Xử Lí Phim by 15/02/11, 02:12 pm
» Mu Đế Vương Season 5 Ep 4 FULL by 30/01/11, 11:48 am
» Friends DVDRip - phim học anh văn - mediafire by 14/01/11, 03:08 pm
» 350 triệu Mail list số lượng cực khủng cập nhật liên tục. (dành cho spam) by 12/01/11, 12:30 pm
» Tạo đĩa Game Nintendo NES (Băng cắm) Chơi trên PlayStation by 11/01/11, 01:21 pm
» Hiren's Boot CD 10.5 đã patch (267.2Mb) mediafre by 28/12/10, 01:46 am
» Grammar 2.9 _ Học ngữ pháp tiếng Anh từ cơ bản đến nâng cao _link MF by 25/12/10, 09:35 pm
» Asia - Giáng Sinh 2010: Noel, Noel, Noel - DVD9 by 18/12/10, 09:56 am
» [MF] Prince of Persia : Warrior Within by 17/12/10, 10:56 am
» Paris By Night 100 - Vip show Party 2-DVD9-1 Link download cực nhanh by 16/12/10, 10:06 am
» Effortless English Program 4 DVD [Audio,video,book]- học english cực tốt by 14/12/10, 08:58 pm
» Fedora Linux 14 Final by 13/12/10, 05:02 pm
» Paris by night 100 [ISO DVD5 & DVD9] by 13/12/10, 04:50 pm
» DVD Vân Sơn 45 - Live in Minnesota 1 link duy nhất by 13/12/10, 04:44 pm
» xin link cd 3 by 09/12/10, 10:16 am
» Adobe Photoshop CS5 Extended v12.0 MAC OSX iSO | 0.9 GB mediafre by 08/12/10, 11:08 pm
» 140 Liên khúc hải ngoại tuyển trọn-450mb by 03/12/10, 07:30 pm
» Adobe After Effects 7.0+ crack- link mediafire by 03/12/10, 05:23 am
» Rosetta Stone 3.21 - Phần mềm học ngoại ngữ by 03/12/10, 02:59 am
» Bộ 19 DVD PhotoShopCafe(siêu tầm) by 03/12/10, 02:59 am
» 55 After Effect Projects by 30/11/10, 06:03 pm
» Từ điển bách khoa Việt Nam-mediafire by 30/11/10, 09:42 am
» SQL Server 2005 by 18/11/10, 09:01 pm
» Windows XP USB Flash Edition 11-2010 SP3(Update) Cài Win với US by 18/11/10, 04:40 pm
» Tài liệu anh văn , Tin Học, đồ Họa by 06/11/10, 11:19 am
» 80 VCD Học Tiếng Anh ENGLISH FOR YOU- ELEMENTARY LEVELS - 30 CD by 03/11/10, 11:08 pm
» hepl by 01/11/10, 08:39 pm
|
|
| Quan ly danh sach hoc sinh 2 | |
| Tác giả | Thông điệp |
---|
laptrinh
Tổng số bài gửi : 282 Join date : 01/07/2010
| Tiêu đề: Quan ly danh sach hoc sinh 2 10/07/10, 08:53 pm | |
| Quan ly danh sach hoc sinh */ #include <stdio.h>
#define MAX 100
typedef struct hocsinh { char hoten[35]; char lop[7]; float diemtoan, diemly, diemhoa; } HOCSINH;
HOCSINH danhsach[MAX]; int numrecords = 0; char filename[] = "DANHSACH.DAT";
int menu() { char c; clrscr(); printf("+----- Menu -----+"); printf("\n+----------------+"); printf("\n+ 1. Nhap +"); printf("\n+ 2. Xoa +"); printf("\n+ 3. Sua doi +"); printf("\n+ 4. Liet ke +"); printf("\n+----------------+"); printf("\n+ 5. Luu len dia +"); printf("\n+ 6. Lay tu dia +"); printf("\n+----------------+"); printf("\n+ 0. Thoat +"); printf("\n+----------------+"); printf("\nChon muc : "); do { c = getch(); } while (c<'0' || c>'6'); return c-'0'; }
void nhapmoi() { int done = 0; char hoten[35]; float diem;
do { printf("\nHo ten (trong de thoat) : "); gets(hoten); if (strlen(hoten) == 0) done = 1; else { strcpy(danhsach[numrecords].hoten, hoten); printf("\nLop : "); gets(danhsach[numrecords].lop); printf("\nDiem toan : "); scanf("%f", &diem); danhsach[numrecords].diemtoan = diem; printf("\nDiem ly : "); scanf("%f", &diem); danhsach[numrecords].diemly = diem; printf("\nDiem hoa : "); scanf("%f%*c", &diem); danhsach[numrecords].diemhoa = diem; numrecords++; } } while (!done); }
void xoa() { int i, done = 0, found, dump[MAX]; char hoten[35], hotentmp[35];
while (!done) { if (numrecords != 0) { printf("\nHo ten hoc sinh can xoa (trong de thoat) : "); gets(hoten); if (strlen(hoten) == 0) done = 1; else { i = found = 0; do { strcpy(hotentmp,danhsach[i].hoten); if (strcmp(strupr(hoten), strupr(hotentmp)) == 0) dump[found++] = i; i++; } while (i<numrecords); if (!found) printf("\nKhong tim thay hoc sinh co ten %s", hoten); else { for (i=0; i<found; i++) { printf("\n%3d %-35s %-7s %4.1f %4.1f %4.1f", i+1, danhsach[dump[i]].hoten,danhsach[dump[i]].lop, danhsach[dump[i]].diemtoan, danhsach[dump[i]].diemly, danhsach[dump[i]].diemhoa); } printf("\n\nTim thay %d hoc sinh.", found); printf("\nChon thu tu muon xoa (neu muon huy bo thi chon so khong nam trong pham vi): "); scanf("%d", &i); if (i >= 1 && i <= found) { for (found=dump[i-1]; found<numrecords-1; found++) danhsach[found] = danhsach[found+1]; numrecords--; printf("\nDa huy"); } else printf("\nViec xoa bi huy bo."); } done = 1; } getch(); } else done = 1; } }
void sua() { int i, done = 0, found, dump[MAX]; char hoten[35], hotentmp[35]; float diem;
while (!done) { if (numrecords != 0) { printf("\nHo ten hoc sinh can sua (trong de thoat) : "); gets(hoten); if (strlen(hoten) == 0) done = 1; else { i = found = 0; do { strcpy(hotentmp,danhsach[i].hoten); if (strcmp(strupr(hoten), strupr(hotentmp)) == 0) dump[found++] = i; i++; } while (i<numrecords); if (!found) printf("\nKhong tim thay hoc sinh co ten %s", hoten); else { for (i=0; i<found; i++) { printf("\n%3d %-35s %-7s %4.1f %4.1f %4.1f", i+1, danhsach[dump[i]].hoten,danhsach[dump[i]].lop, danhsach[dump[i]].diemtoan, danhsach[dump[i]].diemly, danhsach[dump[i]].diemhoa); } printf("\n\nTim thay %d hoc sinh.", found); printf("\nChon thu tu muon sua doi (neu muon huy bo thi chon so khong nam trong pham vi): "); scanf("%d%*c", &i); if (i >= 1 && i <= found) { printf("\n%s\nHo ten : ", danhsach[dump[i-1]].hoten); gets(danhsach[dump[i-1]].hoten); printf("\n%s\nLop : ", danhsach[dump[i-1]].lop); gets(danhsach[dump[i-1]].lop); printf("\n%4.2f\nDiem toan : ",danhsach[dump[i-1]].diemtoan); scanf("%f", &diem); danhsach[dump[i-1]].diemtoan = diem; printf("\n%4.2f\nDiem ly : ", danhsach[dump[i-1]].diemly); scanf("%f", &diem); danhsach[dump[i-1]].diemly = diem; printf("\n%4.2f\nDiem hoa : ", danhsach[dump[i-1]].diemhoa); scanf("%f%*c", &diem); danhsach[dump[i-1]].diemhoa = diem; printf("\nDa thay doi"); } else printf("\nViec thay doi bi huy bo."); } done = 1; } getch(); } else done = 1; } }
void lietke() { int i;
if (numrecords != 0) { printf("\n+-----+------------------------------------+--------+------+------+------+"); printf("\n| STT | H O V A T E N | L O P | TOAN | LY | HOA |"); printf("\n+-----+------------------------------------+--------+------+------+------+"); for (i=0; i<numrecords; i++) { printf("\n| %3d | ", i+1); printf("%-35s| %-7s| %4.1f | %4.1f | %4.1f |", danhsach[i].hoten,danhsach[i].lop, danhsach[i].diemtoan, danhsach[i].diemly, danhsach[i].diemhoa); } printf("\n+-----+------------------------------------+--------+------+------+------+"); } getch(); }
void getdata() { char c; int start, nrec; FILE *fp; long curpos, length;
start = 0; if (numrecords != 0) { printf("\nDang co du lieu trong bo nho. Co muon noi them vao khong?(C/K)"); c = toupper(getch()); if (c == 'C') start = numrecords; else start = 0; } if ((fp = fopen(filename, "r")) == NULL) printf("\nKhong the mo tap tin %s", filename); else { curpos = ftell(fp); fseek(fp, 0L, SEEK_END); length = ftell(fp); fseek(fp, curpos, SEEK_SET); nrec = length / sizeof(HOCSINH); fread(&danhsach[start], sizeof(HOCSINH), nrec, fp); fclose(fp); printf("\nThem vao %d records.", nrec); numrecords = numrecords + nrec; getch(); } }
void putdata() { FILE *fp;
if ((fp = fopen(filename, "w+")) == NULL) printf("\nKhong thay ghi tap tin %s", filename); else { fwrite(&danhsach[0], sizeof(HOCSINH), numrecords, fp); fclose(fp); printf("\nGhi %d records.", numrecords); getch(); } }
void main() { int chon, done = 0;
do { chon = menu(); switch(chon) { case 1 : nhapmoi(); break; case 2 : xoa(); break; case 3 : sua(); break; case 4 : lietke(); break; case 5 : putdata(); break; case 6 : getdata(); break; case 0 : done = 1; } } while (!done); }
|
| | | | Quan ly danh sach hoc sinh 2 | |
|
Trang 1 trong tổng số 1 trang | | |
|