Skip navigation.

Log in | Sign up

http://thaolv.blogspot.com

http://thaolv.blogspot.com

Bài tập hết môn lập trình C++

Đề bài: Anh chị hãy lập trình giải bài toán về quản lý học sinh- Sinh viên bằng ngôn ngữ C++
Các bạn có thể read more hoặc Download here
Mới update thêm bản nữa chạy ngon lành nè Download Here
Bản này là bản FULL, bản nộp cho thầy giáo đó bao gồm file chạy + code + giải thuật nữa Download here

Code hiện còn 1 lỗi:

#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
#include<string.h>
class nguoi
{
private:
char ho[10],ten[10];
int lop,gioitinh,ns;
public:
void nhap()
{
cout<<"\n nhap ho cua sinh vien :";
cin.ignore(1);
cin.get(ho,10);
cout<<"\n nhap ten cua sinh vien :";
cin.ignore(1);
cin.get(ten,10);
cout<<"\n nhap lop sinh vien dang hoc";
cin>>lop;
cout<<"\n nhap nam sinh :";
cin>>ns;
cout<<"\n nhap gioi tinh";
while(1)//---->warning : funtion containing while are not expanded inline
{
cin>>gioitinh;
if((gioitinh==0)||(gioitinh==1))
break;
else
cout<<"\n nhap lai gioi tinh";
}
}
void hien()
{
cout<<setw(10)<<ho<<setw(10)<<ten<<setw(5)<<gioitinh<<setw(5)<<ns<<setw(5)<<lop;
{
int traveten()
{
return ten();
}
};
class diem
{
private:
float csdl,mmt,ctdl,java,trituent,lthdt,moncs,moncn;
public:
void nhap()
{
cout<<"nhap diem mon co so du lieu";
cin>>csdl;
cout<<"nhap diem mon mang may tinh";
cin>>mmt;
cout<<"nhap diem mon cau truc du lieu";
cin>>ctdl;
cout<<"nhap diem mon java";
cin>>java;
cout<<"nhap diem mon lap trinh huong doi tuong: ";
cin>>lthdt;
cout<<"nhap diem mon tri tue nhan tao";
cin>>trituent;
*moncs=mmt+lthdt+ctdl;
*moncn=java+trituent+csdl;
}
void hiends()
{
cout<<setw(5)<<mmt<<setw(5)<<lthdt<<setw(5)<<ctdl<<moncs<<setw(5)<<java<<setw(5)<<trituent<<setw(5)<<csdl<<setw(5)<<moncn;
}
float travediemmoncs()
{
return moncs;
}
float travediemmoncn()
{
return moncn;
}
int kq()
{
if(moncs>=5)&&(moncn>=5)//--->expreesion syntax;
{
return 1;
return 0;
}
}//statament mising;
};
class sinhvien:
public nguoi,diem
{
private:
char masv[5],dieukientotnghiep[20];
public:
void nhap()
{
cout<<"\n nhap ma sinh vien";
cin.ignore(1);
cin.get(masv,5);
nguoi::nhap();
diem::nhap();
if(kq==1)
strcpy(dieukientotngiep,"tot nghiep");
else
strcpy(dieukientotngiep,"khong tot nghiep");
}
void hien()
{
cout<<setw(5)<<masv;
nguoi::hien;
diem::hien;
cout<<setw(20)<<dieukientotnghiep;
}
int timkiemten(char t[])
{
if(strcpy(traveten(),t)==0)
return 1;
return 0;
}
void sxtheoten(sinhvien *sv1,sinhvien *sv2)
{
sinhvien tam;
if(strcpy(sv1->traveten(),sv2->traveten())>0)
{
tam=*sv1;
*sv1=*sv2;
*sv2=tam;
}
}
void sapxeptheodiemmoncs(sinhvien *sv1,sinhvien *sv2)
{
sinhvien tam;
if(sv1->diem.moncs<sv2->diem.moncs)
{
tam=*sv1;
*sv1=*sv2;
*sv2=tam;
}
}
void them(sinhvien *sv,int *n,sinhvien tam)
{
sv[*n]=tam;
*n=*n+1;
}
void xoa(sinhvien *sv,int *n,int vt)
{
int i;
for(i=vt-1;i<*n;i++)//---->warning : funtion containing while are not expanded inline
sv=sv[i+1];
*n=*n-1;
}
void sua(sinhvien *sv)
{
sinhvien tam;
cout<<"\n nhap thong tin can sua";
tam.nhap();
*sv=tam;
}
void hiends(sinhvien *sv,int n)
{
int i;
for(i=0;i<n;i++)
{
cout<<"\n"<<setw(4)<<i+1;
sv.hiends();//--->funtion 'hien'should have protype
}
getch();
}
void main()
{
sinhvien *sv,tam;
int i,j,m,vt;
char t[10];
clrscr();
cout<<"\n nhap so luong sinh vien:";
cin>>m;
sv=new sinhvien[m];
cout<<"\n nhap danh sach sinh vien";
for(i=0;i<n;i++)//--->undefined symbol 'n'l
{
cout<<"\n nhap sinh vien thu :"<<i+1;
sv.nhap();
}
cout<<"\n danh sach thi sinh vua nhap : ";
for(i=0;i<n;i++)
{
cout<<"\n"<<i+1;
sv.hiends();
}
cout<<"\n nhap ten can tim : ";
cin.ignore(1;)
cin.get(i,10);
cout<<"\n danh sach thi sinh co ten "<<t<<"la : \n";
for(i=0;i<n;i++)
if(sv,timkiemten(t)==1)//-->funtion 'timkiemten' should have protype
{
cout<<"\n";
sv.hiends();
}

for(i=0;i<m-1;i++)
for(j=i+1;j<m;j++)
{
sapxeptheodiemmoncs(&sv,&sv[j]);
cout<<"”\n danh sach sinh vien vua duoc sap xep theo diem mon co so: ”";
hiends(sv,m);

for(i=0;i<m-1;i++)
for(j=i+1;j<m;j++)
sapxeptheodiemmoncn(&sv,&sv[j]);
cout<<"”\n danh sach sinh vien vua duoc sap xep theo diem mon chuyen nganh: ”";
hiends(sv,m);

for(i=0;i<m-1;i++)
for(j=i+1;j<m;j++)
sapxeptheoten(&sv,&sv[j]);
cout<<"”\n danh sach sinh vien vua duoc sap xep theo ten: ”";
hiends(sv,m);

cout<<"”\n nhap cac thong tin ve sinh vien can nhap them : ”";
tam.nhap();
them(sv,&m,tam);

cout<<"\n danh sach sinh vien vua duoc them vao : ";
hiends(sv,m);

cout<<"\n nhap vi tri can sua:";
cin>>vt;
sua(&sv[vt-1]);

cout<<"\n danh sach sinh vien vua duoc dua doi : ";
hiends(sv,m);
cout<<"\n nhap vi tri can xoa";
cin>>vt;
xoa(&sv,&m,vt);
cout<<"\n danh sach sinh vien vua xoa : ";
hiends(sv,m);
getch();
delete sv;
}
}

Download here

Hướng dẫn cài MS-DOS & Win chạy song songI Love Music...

Comments

Anonymous 12. August 2009, 09:27

thanh writes:

gia mot bai toan lap trinh nhe





Anonymous 29. November 2009, 00:15

Anonymous writes:

bai tap ve quan ly nong duoc (c++). co 4 lop gom "date, khach hang, hoa don, nong duoc".yeu cau tu do.giup em voi, em dang lam bai tap lon do

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

December 2009
M T W T F S S
November 2009January 2010
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31