SINH VIEN 2

/*

by trungkienho

*/

#include<conio.h>

#include<iostream.h>

#include<stdio.h>

struct SINHVIEN

{

char TenSV[30];

char MaSo[10];

float DTB;

};

struct nodeSV

{

SINHVIEN data;

nodeSV * next;

};

struct listSV

{

nodeSV * headSV;

nodeSV * tailSV;

};

struct LOP

{

int SiSo;

char Ten[30];

listSV data;

};

struct nodeL

{

LOP data;

nodeL * next;

};

struct listL

{

nodeL * headL;

nodeL * tailL;

};

//================KHOI TAO SINH VIEN===========

void InitSV(listSV& SV)

{

SV.headSV=SV.tailSV=NULL;

}

//===============KHOI TAO LOP================

void InitL(listL &L)

{

L.headL=L.tailL=NULL;

}

//============TAO NODE SINH VIEN=================

nodeSV * GetNodeSV(SINHVIEN x)

{

nodeSV *p;

p=new nodeSV;

if(p==NULL)

{

cout<<"FULL MEMORY ";

return NULL;

}

else

{

p->data=x;

p->next=NULL;

return p;

}

}

//===========TAO NODE LOP==============

nodeL * GetNodeL(LOP x)

{

nodeL *p;

p=new nodeL;

if(p==NULL)

{

cout<<"FULL MEMORY ";

return NULL;

}

else

{

p->data=x;

p->next=NULL;

return p;

}

}

//================INPUT LIST SINH VIEN===============

void inputlistSV(listSV &SV,SINHVIEN x)

{

nodeSV * p;

p=GetNodeSV(x);

if(SV.headSV==NULL)

{ cout<<"

nhap dau";

SV.headSV=SV.tailSV=p;

}

else

{ cout<<"

nhap cuoi";

SV.tailSV->next=p;

SV.tailSV=p;

}

}

//===============INPUT LIST LOP=================

void inputlistL(listL &L,LOP x)

{

nodeL * p;

p=GetNodeL(x);

if(L.headL==NULL)

{cout<<"

Nhap lop dau";

L.headL=L.tailL=p;

}

else

{cout<<"

Nhap lop cuoi";

L.tailL->next=p;

L.tailL=p;

}

}

//==================NHAP SINH VIEN=============

SINHVIEN inputSV()

{

SINHVIEN x;

cout<<"Nhap Ma So: ";

gets(x.MaSo);

cout<<"Nhap Ten: ";

gets(x.TenSV);

cout<<"Nhap DTB: ";

cin>>x.DTB;

return x;

}

//==================NHAP LOP=============

LOP inputL()

{

SINHVIEN y;

LOP x;

listSV SV;

cout<<"Nhap Ten Lop: ";

gets(x.Ten);

cout<<"Nhap Si So: ";

cin>>x.SiSo;

for(int i=0;i<x.SiSo;i++)

{

cout<<"Sinh Vien Thu["<<i+1<<"]";

y=inputSV();

inputlistSV(SV,y);

}

x.data=SV;

return x;

}

//=========OUTPUT SINH VIEN==============

void outputlistSV(listSV SV)

{

nodeSV *p;

p=SV.headSV;

while(p!=NULL)

{

cout<<"

Ma So la: ";

printf(p->data.MaSo);

cout<<"

Ho Ten la: ";

printf(p->data.TenSV);

cout<<"

DTB la: ";

cout<<p->data.DTB;

p=p->next;

}

}

//=========OUTPUT LOP================

void outputlistL(listL L)

{

listSV SV;

nodeL *p;

p=L.headL;

while(p!=NULL)

{

cout<<"

Ten Lop la:";

printf(p->data.Ten);

cout<<"

Si So la: ";

cout<<p->data.SiSo;

cout<<"

Danh Sach Cac Sinh Vien: ";

outputlistSV(p->data.data);

p=p->next;

}

}

//==================VOID MAIN===============

void main()

{

clrscr();

listSV SV;

listL L;

InitSV(SV);

InitL(L);

LOP x;

nhan:

cout<<" LOP HOC

";

int i,n;

cout<<"Nhap vao so lop: ";

cin>>n;

if(n<1)

{

cout<<"Ban da nhap khong dung

Xin vui long nhap lai .";

getch();

goto nhan;

}

else

{

for(i=0;i<n;i++)

{

cout<<"Nhap vao Lop thu ["<<i+1<<"]

";

x=inputL();

inputlistL(L,x);

}

}

outputlistL(L);

getch();

}

baI 2

#include <iostream.h>

#include <conio.h>

#include <stdlib.h>

#include <dos.h>

#include <fontvn.h>

struct node

{

int data;

node *next;

};

typedef node *pnode;

/*==============================*/

/* NHOM CAC HAM TRANG TRI*/

void lexuanhoang();

int chaomung();

void thoat();

void menu();

/*==============================*/

/*==================*/

/* NHOM HAM CAC THAO TAC XU LI CO BAN*/

pnode taonodemoi(int);

void khoitaodanhsach(pnode&);

void huydanhsach(pnode &);

void duyetdanhsach(pnode);

void themdau(pnode &, int);

void themcuoi(pnode &, int);

void xoadau(pnode &);

void xoacuoi(pnode &);

void thembatky(pnode &, int, int);

void xoabatky(pnode &, int);

int layphantubatky(pnode &, int);

void xoavitri(pnode &,int);

void xoaphantuX(pnode &, int);

int laydau(pnode &);

int laycuoi(pnode &);

/*===========================*/

/*==========================*/

/* NHOM HAM SAP XEP*/

void sapxeptang(pnode&);

void sapxepgiam(pnode&);

void am0duong(pnode &);

void chan0le(pnode &);

/*===========================*/

/*===========================*/

/* NHOM HAM TIM KIEM*/

int timkiem(pnode, int);

int kiemtrasnt(int);

void songuyento(pnode);

int maxchan(pnode);

int minle(pnode);

/*===========================*/

/*==========================*/

/* NHOM HAM DEM*/

int demchan(pnode);

int demam(pnode);

int demso0(pnode);

/*==========================*/

/* NHOM HAM TINH TOAN*/

int max(pnode);

int min(pnode);

int tong(pnode);

float trungbinhcong(pnode);

/*===========================*/

void main()

{

changeFont();

lexuanhoang();

textmode(C80);

}

void khoitaodanhsach(pnode &H)

{

H=NULL;

}

void huydanhsach(pnode &H)

{

pnode p;

while(p!=NULL)

{

p=H;

H=H->next;

delete p;

}

}

void duyetdanhsach(pnode H)

{

pnode p = H;

if(H == NULL)

{

cout<<"Danh sach rong";

getch();

return;

}

cout<<"

H -> ";

while(p != NULL)

{

cout<<p->data<<" -> ";

p = p->next;

}

cout<<"NULL";

getch();

}

pnode taonodemoi(int x)

{

pnode p;

p=new node;

p->data=x;

p->next=NULL;

return p;

}

void themdau(pnode &H, int x)

{

pnode p;

p=taonodemoi(x);

p->next=H;

H=p;

}

void themcuoi(pnode &H, int x)

{

pnode p, q;

p=H;

if(H==NULL)

themdau(H, x);

while(p->next!=NULL)

{

p=p->next;

}

q=taonodemoi(x);

p->next=q;

}

void xoadau(pnode &H)

{

if(H==NULL)

{

cout<<"

Danh S¸ch Rçng!";

return;

}

pnode p;

p=H;

H=p->next;

delete p;

}

int laydau(pnode &H)

{

if(H==NULL)

{

cout<<"

Danh S¸ch Rçng!";

return NULL;

}

pnode p;

int x;

p=H; H=H->next;

x=p->data;

delete p;

return x;

}

void xoacuoi(pnode &H)

{

if(H==NULL)

{

cout<<"

Danh S¸ch Rçng!";

return;

}

pnode p, q;

p=H;

while(p->next!=NULL)

{

q=p;

p=p->next;

}

q->next=NULL;

delete p;

}

int laycuoi(pnode &H)

{

if(H==NULL)

{

cout<<"

Danh S¸ch Rçng!";

return NULL;

}

pnode p, q;

int x;

p=H;

while(p!=NULL)

{

q=p;

p=p->next;

}

x=p->data;

delete p;

q->next=NULL;

return x;

}

void thembatky(pnode &H,int x,int k)

{

int dem = 0;

pnode p = H;

pnode q = NULL;

int i=0;

while(p != NULL)

{

p = p->next;

dem ++;

}

if(k<0 || k>dem)

{

cout<<"VÞ TrÝ Kh«ng Hîp LÖ";

getch();

return;

}

if(k == 0)

{

themdau(H,x);

return;

}

if(k == dem)

{

themcuoi(H,x);

return;

}

p = H;

while(i<k)

{

i++;

q = p;

p = p->next;

}

q->next = new node;

q = q->next;

q->data = x;

q->next = p;

}

void xoabatky(pnode &H,int k)

{

int i = 0;

pnode p = H,q = NULL;

while(p->next != NULL)

{

i++;

p = p->next;

}

if(k>i)

{

cout<<"VÞ TrÝ Kh«ng Hîp LÖ";

getch();

return;

}

else

if(k == i)

{

xoacuoi(H);

return;

}

if(k == 0)

{

xoadau(H);

return;

}

else

{

p = H;

for(i=0;i<k;i++)

{

q = p;

p = p->next;

}

q->next = p->next;

delete p;

}

}

int layphantubatky(pnode &H,int k)

{

int x=0;

int i = 0;

pnode p = H,q = NULL;

while(p->next != NULL)

{

i++;

p = p->next;

}

if(k>i)

{

cout<<"VÞ TrÝ Kh«ng HîP lÖ";

getch();

return NULL;

}

else

if(k == i)

{

laycuoi(H);

}

if(k == 0)

{

laydau(H);

}

else

{

p = H;

for(i=0;i<k;i++)

{

q = p;

p = p->next;

}

q->next = p->next;

return x=p->data;

}

return x;

}

void xoavitri(pnode &H,int k)

{

int i = 0;

pnode p = H,q = NULL;

while(p->next != NULL)

{

i++;

p = p->next;

}

if(k>i)

{

cout<<"VÞ TrÝ Kh«ng Hîp LÖ";

getch();

return;

}

else

if(k == i)

{

xoacuoi(H);

return;

}

if(k == 0)

{

xoadau(H);

return;

}

else

{

p = H;

for(i=0;i<k;i++)

{

q = p;

p = p->next;

}

q->next = p->next;

delete p;

}

}

void xoaphantuX(pnode &H,int x)

{

pnode p = H,q = NULL;

int i = 0;

while(p != NULL)

{

if(p->data == x)

{

xoadau(H);

i = 0;

p = H;

continue;

}

i++;

q = p;

p = p->next;

if(p->data == x)

{

if (p==NULL)

break;

xoavitri(H,i);

p = q;

i--;

}

}

}

int timkiem(pnode H, int x)

{

pnode p;

p=H;

while(p!=NULL)

{

if(p->data==x)

return 1;

p=p->next;

}

return 0;

}

void hoanvi(int &a,int &b)

{

int c;

c = a;

a = b;

b = c;

}

void sapxeptang(pnode &H)

{

pnode p,q;

p = H;

cout<<"

D·y §· §­îc S¾p XÕp T¨ng: ";

while(p->next != NULL)

{

q = p->next;

while(q != NULL)

{

if(p->data > q->data)

hoanvi(p->data,q->data);

q = q->next;

}

p = p->next;

}

}

void sapxepgiam(pnode &H)

{

pnode p,q;

p = H;

cout<<"

D·y §· §­îc S¾p XÕp Gi¶m: ";

while(p->next != NULL)

{

q = p->next;

while(q != NULL)

{

if(p->data < q->data)

hoanvi(p->data,q->data);

q = q->next;

}

p = p->next;

}

}

int max(pnode H)

{

if(H==NULL)

{

return NULL;

}

pnode p;

int max;

max=H->data;

p=H->next;

while(p!=NULL)

{

if(p->data>max)

{

max=p->data;

}

p=p->next;

}

return max;

}

int min(pnode H)

{

if(H==NULL)

{

return NULL;

}

pnode p;

int min;

min=H->data;

p=H->next;

while(p!=NULL)

{

if(p->data<min)

{

min=p->data;

}

p=p->next;

}

return min;

}

int tong(pnode H)

{

pnode p;

int tong=0;

p=H;

while(p!=NULL)

{

tong+=p->data;

p=p->next;

}

return tong;

}

float trungbinhcong(pnode H)

{

pnode p, q;

p=H; q=H;

int n=0;

float tbc=0;

int tong=0;

ì(H==NULL)

return NULL;

while(p!=NULL)

{

n++;

p=p->next;

}

while(q!=NULL)

{

tong+=q->data;

q=q->next;

}

tbc=tong/n;

return tbc;

}

int kiemtrasnt(int n)

{

if(n<0)

return 0;

if(n==1||n==0)

return 0;

for(int i=2; i<n; i++)

if(n%i==0)

return 0;

return 1;

}

void songuyento(pnode H)

{

pnode p;

p=H;

cout<<"

C¸c Sè Nguyªn Tè Trong D·y Lµ:

";

while(p!=NULL)

{

if(kiemtrasnt(p->data)==1)

cout<<p->data<<" , ";

p=p->next;

}

}

int maxchan(pnode H)

{

pnode p, q;

if(H==NULL)

return NULL;

p=H;

q=p->next;

while(p!=NULL && p->data%2==1)

p=p->next;

while(q!=NULL)

{

if(q->data%2==0 && q->data>p->data && p->data%2==0 && p->data!=0)

p=q;

q=q->next;

}

return p->data;

}

int minle(pnode H)

{

pnode p, q;

if(H==NULL)

return NULL;

p=H;

while(p!=NULL && p->data%2!=1)

p=p->next;

while(q!=NULL)

{

if(q->data%2!=0 && q->data<p->data && p->data%2!=0)

p=q;

q=q->next;

}

return p->data;

}

void am0duong(pnode &H)

{

pnode p;

int dem=1;

int n;

p=H;

while(p!=NULL)

{

p=p->next;

dem++;

}

if(dem==1)

{

cout<<"

Danh S¸ch Rçng";

return;

}

p=H;

n=1;

while(n!=dem)

{

if(p->data<0)

{

themcuoi(H,p->data);

}

p=p->next;

n++;

}

p=H;

n=1;

while(n!=dem)

{

if(p->data==0)

{

themcuoi(H,p->data);

}

p=p->next;

n++;

}

p=H;

n=1;

while(n!=dem)

{

if(p->data>0)

{

themcuoi(H,p->data);

}

p=p->next;

n++;

}

n=1;

while(n!=dem)

{

xoadau(H);

n++;

}

}

void chan0le(pnode &H)

{

pnode p;

int dem=1;

int n;

p=H;

while(p!=NULL)

{

p=p->next;

dem++;

}

if(dem==1)

{

cout<<"

Danh S¸ch Rçng";

return;

}

p=H;

n=1;

while(n!=dem)

{

if(p->data%2==0 && p->data!=0)

{

themcuoi(H,p->data);

}

p=p->next;

n++;

}

p=H;

n=1;

while(n!=dem)

{

if(p->data==0)

{

themcuoi(H,p->data);

}

p=p->next;

n++;

}

p=H;

n=1;

while(n!=dem)

{

if(p->data%2!=0)

{

themcuoi(H,p->data);

}

p=p->next;

n++;

}

n=1;

while(n!=dem)

{

xoadau(H);

n++;

}

}

int demchan(pnode H)

{

pnode p; int dem=0;

p=H;

int flag=0;

while(p!=NULL)

{

if(p->data%2==0)

{

flag=1;

break;

}

p=p->next;

}

if(flag==0)

return NULL;

while(p!=NULL)

{

if(p->data%2==0)

dem++;

p=p->next;

}

return dem;

}

int demam(pnode H)

{

pnode p; int dem=0;

p=H;

int flag=0;

while(p!=NULL)

{

if(p->data<0)

{

flag=1;

break;

}

p=p->next;

}

if(flag==0)

return NULL;

while(p!=NULL)

{

if(p->data<0)

dem++;

p=p->next;

}

return dem;

}

int demso0(pnode H)

{

pnode p; int dem=0;

p=H;

int flag=0;

while(p!=NULL)

{

if(p->data==0)

{

flag=1;

break;

}

p=p->next;

}

if(flag==0)

return NULL;

while(p!=NULL)

{

if(p->data==0)

dem++;

p=p->next;

}

return dem;

}

void lexuanhoang()

{

menu();

}

int chaomung()

{

int chon;

cout<<"

";

cout<<"Chay Chuong Trinh O Che Do FULL SCREEN De Thay Duoc Giao Dien Tieng Viet";

cout<<"

\t\t Nhan To Hop Phim ALT + ENTER Sau Do Nhan ENTER";

getch();

delay(1000);

cout<<"

NhÊn Enter §Ó Vµo:

";

getch();

delay(1000);

char msg[] = " ============================= EdwardThienHoang ===========================

";

int i = 0;

while (msg[i])

{

putc(msg[i++], stdout);

delay(40);

}

cout<<"

\t\t Chµo TÊt C¶ C¸c B¹n!";

delay(100);

cout<<"

\t §©y lµ Mét Sè Bµi TËp VÒ DSLK§ Trªn C¸c Sè Nguyªn";

delay(100);

cout<<"

\t\t M×nh §· ViÕt Ra Vµ ViÖt Hãa Nã";

delay(100);

cout<<"

\t\t\t Mong C¸c B¹n SÏ ThÝch Thó";

delay(100);

cout<<"

\t Do KiÕn Thøc Cña M×nh Cßn H¹n ChÕ Nªn Bµi Nµy Cßn NhiÒu Lçi";

delay(100);

cout<<"

NÕu Hµm Nµo Ch¹y Sai Th× C¸c B¹n Tù ChØnh Söa";

cout<<"

\t\t\t\t §Ó Cho Ch­¬ng Tr×nh Nµy Hoµn ThiÖn NhÐ!";

delay(100);

cout<<"

\t §Ó Vµo Ch­¬ng Tr×nh, C¸c B¹n";

delay(500);

char chonst[] = " NhÊn PhÝm Sè 1";

i = 0;

while (chonst[i])

{

putc(chonst[i++], stdout);

delay(50);

}

delay(200);

cout<<"

\t\t\t NÕu Muèn Tho¸t Ch­¬ng Tr×nh, Vui Lßng";

delay(500);

char chonstt[] = " NhÊn PhÝm Sè -1";

i = 0;

while (chonstt[i])

{

putc(chonstt[i++], stdout);

delay(50);

}

delay(500);

char chons[] = "

NhÊn Chän: ";

i = 0;

while (chons[i])

{

putc(chons[i++], stdout);

delay(40);

}

cin>>chon;

cout<<"

===========================================================================

";

if(chon==1)

return 1;

return -1;

}

void thoat()

{

int thoat;

cout<<" Cã Ch¾c B¹n Muèn Tho¸t?( NhÊn -1 LÇn N÷a)";

cout<<"

X¸c §Þnh Tho¸t (-1): ";

cin>>thoat;

if(thoat==-1)

{

char msg[] = "

\t\t Lª Xu©n Hoµng! T¹m BiÖt C¸c B¹n";

int i = 0;

while (msg[i])

{

putc(msg[i++], stdout);

delay(30);

}

char ms[] = "

\t\t Chóc C¸c B¹n Häc Mçi Ngµy Mét Tèt H¬n!";

i = 0;

while (ms[i])

{

putc(ms[i++], stdout);

delay(30);

}

delay (500);

exit(1);

}

menu();

}

void menu()

{

clrscr();

int chon;

int x, k;

if(chaomung()!=1)

thoat();

{

pnode H;

khoitaodanhsach(H);

do

{

head:

cout<<"

";

char menu[] = "====================== MENU =========================";

int i = 0;

while (menu[i])

{

putc(menu[i++], stdout);

delay(10);

}

delay(300);

cout<<"

0. Tho¸t";

cout<<"\t\t\t 1. Xem Danh S¸ch";

cout<<"

2. Thªm Vµo PhÇn Tö §Çu";

cout<<"\t 3. Thªm Vµo PhÇn Tö Cuèi";

cout<<"

4. Thªm Vµo VÞ TrÝ BÊt kú";

cout<<"\t 5. Xãa PhÇn Tö §Çu";

cout<<"

6. Xãa PhÇn Tö Cuèi ";

cout<<"\t\t 7. Xãa PhÇn Tö BÊt Kú";

cout<<"

8. Xãa PhÇn Tö X";

cout<<"\t\t 9. LÊy Ra PhÇn Tö §µu";

cout<<"

10. LÊy Ra PhÇn Tö Cuèi ";

cout<<"\t 11. LÊy Ra PhÇn Tö BÊt kú ";

cout<<"

12. S¾p XÕp D·y T¨ng DÇn";

cout<<"\t 13. S¾p XÕp D·y Gi¶m DÇn ";

cout<<"

14. S¨p XÕp ¢m == 0 == D­¬ng";

cout<<"\t 15. S¨p XÕp Ch½n == 0 == LÎ ";

cout<<"

16. T×m KiÕm Trong D·y";

cout<<"\t\t 17. Sè Nguyªn Tè Trong D·y";

cout<<"

18. Sè Ch½n Lín NhÊt Cña D·y";

cout<<"\t 19. Sè LÎ Nhá NhÊt Cña D·y ";

cout<<"

20. §Õm Sè Ch½n Trong D·y";

cout<<"\t 21. §Õm Sè ¢m Trong D·y ";

cout<<"

22. §Õm Sè 0";

cout<<"\t\t\t 23. Sè Lín NhÊt Cña D·y";

cout<<"

24. Sè Nhá NhÊt Cña D·y ";

cout<<"\t 25. Tæng Cña D·y";

cout<<"

26. Trung B×nh Céng Cña D·y";

char mbc[]="

\t\t\tMêi B¹n Chän: ";

i=0;

while (mbc[i])

{

putc(mbc[i++], stdout);

delay(40);

}

cin>>chon;

cout<<"

";

if(chon==0)

thoat();

switch(chon)

{

case 1:

duyetdanhsach(H);

goto head;

case 2:

cout<<"

NhËp PhÇn Tö §Ó Thªm §Çu: ";

cin>>x;

themdau(H,x);

goto head;

case 3:

cout<<"

NhËp PhÇn Tö §Ó Thªm Cuèi: ";

cin>>x;

themcuoi(H,x);

goto head;

case 4:

cout<<"

B¹n Muèn Thªm Vµo VÞ TrÝ Nµo? ";

cin>>k;

cout<<"

NhËp PhÇn Tö §Ó Thªm Vµo VÞ TrÝ "<<k<<": ";

cin>>x;

thembatky(H,x,k);

goto head;

case 5:

cout<<"

§· Xãa PhÇn Tö §Çu";

xoadau(H);

goto head;

case 6:

cout<<"

§· Xãa PhÇn Tö Cuèi ";

xoacuoi(H);

goto head;

case 7:

cout<<"

NhËp VÞ TrÝ CÇn Xãa: ";

cin>>k;

xoabatky(H,k);

goto head;

case 8:

cout<<"

NhËp PhÇn Tö CÇn Xãa: ";

cin>>x;

xoaphantuX(H,x);

goto head;

case 9:

cout<<"

LÊy Ra PhÇn Tö §Çu: ";

cout<<laydau(H);

goto head;

case 10:

cout<<"

LÊy Ra PhÇn Tö Cuèi: ";

cout<<laycuoi(H);

goto head;

case 11:

cout<<"

LÊy Ra PhÇn Tö BÊt Kú: ";

cout<<"

NhËp VÞ TrÝ CÇn LÊy: ";

cin>>k;

cout<<"

PhÇn Tö §­îc LÊy Ra Lµ:"<<layphantubatky(H,k);

goto head;

case 12:

if(H == NULL)

{

cout<<"Danh S¸ch Rçng";

getch();

goto head;

}

sapxeptang(H);

goto head;

case 13:

if(H == NULL)

{

cout<<"Danh S¸ch Rçng";

getch();

goto head;

}

sapxepgiam(H);

goto head;

case 14:

cout<<"

§· S¾p XÕp Theo Thø Tù: ¢m == 0 == D­¬ng:

";

am0duong(H);

goto head;

case 15:

cout<<"

§· S¾p XÕp Theo Thø Tù: Ch½n == 0 == LÎ:

";

chan0le(H);

goto head;

case 16:

cout<<"

NhËp Sè CÇn T×m: ";

cin>>x;

if(timkiem(H,x)==1)

{

cout<<"

Cã "<<x<<" Trong D·y";

goto head;

}

cout<<"

Kh«ng Cã "<<x<<" Trong D·y";

goto head;

case 17:

songuyento(H);

goto head;

case 18:

cout<<"

Sè Ch½n Lín NhÊt Lµ: ";

if(maxchan(H)==0)

{

cout<<"

Kh«ng Cã Sè Ch½n Trong D·y";

goto head;

}

cout<<maxchan(H);

goto head;

case 19:

cout<<"

Sè LÎ Nhá NhÊt Lµ: ";

if(minle(H)==0)

{

cout<<"

Kh«ng Cã Sè LÎ Trong D·y";

goto head;

}

cout<<minle(H);

goto head;

case 20:

if(demchan(H)==NULL)

{

cout<<"

Khong Cã PhÇn Tö Ch½n Trong D·y ";

goto head;

}

cout<<"

Cã : "<<demchan(H)<<" Sè Ch½n Trong D·y";

goto head;

case 21:

if(demam(H)==NULL)

{

cout<<"

Khong Cã PhÇn Tö ¢m Trong D·y ";

goto head;

}

cout<<"

Cã : "<<demam(H)<<" Sè ¢m Trong D·y";

goto head;

case 22:

if(demso0(H)==NULL)

{

cout<<"

Khong Cã PhÇn Tö 0 Trong D·y ";

goto head;

}

cout<<"

Cã"<<demso0(H)<<" Sè 0 Trong D·y";

goto head;

case 23:

cout<<"

Sè Lín NhÊt Trong D·y: ";

if(max(H)==NULL)

cout<<"Kh«ng Cã. Danh S¸ch Rçng.";

cout<<max(H);

goto head;

case 24:

cout<<"

Sè Nhá NhÊt Trong D·y: ";

if(min(H)==NULL)

cout<<"Kh«ng Cã. Danh S¸ch Rçng.";

cout<<min(H);

goto head;

case 25:

cout<<"

Tæng C¸c PhÇn Tö: "<<tong(H);

goto head;

case 26:

cout<<"

Trung B×nh Céng Cña D·y:"<<trungbinhcong(H);

goto head;

default:

{

cout<<"

Vui Lßng Chän Mét Trong C¸c Sè Trªn!";

getch();

goto head;

}

}

}while(chon!=0);

huydanhsach(H);

}

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: #longphuc