⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qlsvduy.cpp

📁 examples C,c++ codes programs
💻 CPP
字号:
//chuong trinh quan ly sinh vien
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<iomanip.h>
class qlsv
{
char hoten[20];
unsigned int msv, toan, ly, hoa;
public:
void nhapdulieu();
float tb();
void hienthi();


};
void qlsv::nhapdulieu()
{
cout<<"\nnhap ho ten   : "; gets(hoten);

cout<<"\nnhap msv      : "; cin>>msv;

cout<<"\nnhap diem toan: "; cin>>toan;

cout<<"\nnhap diem ly  : "; cin>>ly;

cout<<"\nnhap diem hoa : "; cin>>hoa;
}
float qlsv::tb()
{
return (toan+ly+hoa)/3;
}
void qlsv::hienthi()
{
cout<<setw(15)<<hoten<<setw(10)<<msv<<setw(10)<<toan<<setw(10)<<ly<<setw(10)<<hoa<<setw(15)<<tb()<<endl;
}
void main ()
{
int i,j,n;
clrscr();
qlsv *sv;
cout<<"\nnhap so sinh vien : ";
cin>>n;
sv=new qlsv[n];
for(i=0;i<n;i++)
{
cout<<"\nnhap du lieu sinh vien thu "<<i+1;
sv[i].nhapdulieu();
sv[i].tb();
}
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if (sv[i].tb() > sv[j].tb())
{
qlsv tam;
tam=sv[i];
sv[i]=sv[j];
sv[j]=tam;
}
cout<<"\n danh sach sinh vien sap xep tang dan theo diem trung binh:\n";
cout<<setw(15)<<"hoten"<<setw(10)<<"mssv"<<setw(10)<<"toan"<<setw(10)<<"ly"<<setw(10)<<"hoa"<<setw(15)<<"trungbinh"<<endl;
for(i=0;i<n;i++)
sv[i].hienthi();
delete(sv);
getch();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -