bai tap c++

Tong hieu so phuc

#include <math.h>

typedef struct tagcomplex {

float thuc, ao;

} complex;

complex tong(complex a, complex

{

complex c;

c.thuc = a.thuc + b.thuc;

c.ao = a.ao + b.ao;

return c;

}

complex hieu(complex a, complex

{

complex c;

c.thuc = a.thuc - b.thuc;

c.ao = a.ao - b.ao;

return c;

}

Phan so

#include "iostream.h"

#include "stdio.h"

#include "conio.h"

//mo ta lop PS

class PS

{

int t,m;

public:

void nhap();

void xuat();

PS cong(PS y); //PS cong(PS'this,PSy)

PS tru(PS y);

friend PS nhan(PS x,PS y);

friend PS chia(PS x,PS y);

};

void PS::nhap()

{

cout<<"nhap tu so"; cin>>t;

cout<<"nhap mau so"; cin>>m;

}

void PS::xuat()

{

cout<<t<<"/"<<m;

}

PS PS::cong(PS y)

{

PS kq;

kq.t=t*y.m+y.t*m;

kq.m=m*y.m;

return kq;

}

PS PS::tru(PS y)

{

PS kq;

kq.t=t*y.m-y.t*m;

kq.m=m*y.m;

return kq;

}

PS nhan(PS x,PS y)

{

PS kq;

kq.t=x.t*y.t;

kq.m=x.m*y.m;

return kq;

}

PS chia(PS x,PS y)

{

PS kq;

kq.t=x.t*y.m;

kq.m=x.m*y.t;

return kq;

}

int main()

{

PS a,b,kq;

cout<<"

nhap ps a:

";

a.nhap();

cout<<"

nhap ps b:

";

b.nhap();

kq=a.cong(b);

cout<<"

tong 2ps:"; kq.xuat();

kq=a.tru(b);

cout<<"

hieu 2ps:"; kq.xuat();

kq=nhan(a,b);

cout<<"

tich 2ps:"; kq.xuat();

kq=chia(a,b);

cout<<"

thuong 2ps:"; kq.xuat();

getch();

}

DSLK SV

#include<stdio.h>

#include<conio.h>

#include<iostream.h>

#include<string.h>

#include<ctype.h>

typedef struct sinhvien{

int masv;

char ten[30];

float dtb;

};

typedef struct node{

sinhvien info;

node *next;

};

node *head;

int count=0;

void init(){

char *tl="Chua co";

head->info.masv=0;

strcpy(head->info.ten, tl);

head->info.dtb=0;

head->next=NULL;

count=0;

}

node *makenode(sinhvien x){

node *p=new node;

p->info.masv=x.masv;

strcpy(p->info.ten, x.ten);

p->info.dtb=x.dtb;

p->next=NULL;

return p;

}

void insert(node *p,int n){

node *q,*r;

if(n==0){

q=head->next;

head->next=p;

p->next=q;

cout<<"Da chen vao dau danh sach";

count++;

return;

}

q=head->next;int i=0;

while(q!=NULL&&i<n){

r=q;

q=q->next;

i++;

}

r->next=p;

p->next=q;

cout<<"

Da chen vao vi tri"<<n<<" ";

count++;

}

void remove(int n){

node *p,*q=head,*r;

int i=0;

if(n==0){

p=head->next;

head->next=p->next;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<p->info.masv;

cout<<"

Ho va ten: "<<p->info.ten;

cout<<"

Diem trung binh: "<<p->info.dtb;

getch();

delete p;

count--;

return;

}

if(n>count){

while(q->next!=NULL){

r=q;

q=q->next;

}

r->next=NULL;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

while(i<n){

r=q;

q=q->next;

i++;

}

p=q->next;

r->next=p;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

void traver(){

node *q=head->next;

cout<<"

Cac sinh vien trong danh sach gom: ";

while(q!=NULL){

cout<<"

Ma sinh vien: ";

cout<<q->info.masv<<"

";

cout<<"

Ho va Ten: ";

cout<<q->info.ten<<"

";

cout<<"

Diem trung binh: ";

cout<<q->info.dtb<<"

";

q=q->next;

}

getch();

}

void main(){

clrscr();

int chon;

sinhvien x;

node *p,ketqua;

while(1){

cout<<"

DANH SACH LIEN KET DON

";

cout<<"

1. Them mot sinh vien vao dau danh sach";

cout<<"

2. Them mot sinh vien vi tri bat ky";

cout<<"

3. Loai bo sinh vien o dau danh sach";

cout<<"

4. Loai bo sinh vien o vi tri bat ky";

cout<<"

5. Duyet danh sach";

cout<<"

z. Thoat";

chon=getch();

chon=toupper(chon);

if(chon=='Z') break;

switch(chon){

case'1':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

insert(p,0);

break;

case'2':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

cout<<"

Nhap vi tri can them: ";

cin>>n;

insert(p,n);

break;

case'3':

remove(0);

break;

case'4':

cout<<"

Nhap vi tri can loai bo: ";

cin>>n;

remove(n);

break;

case'5':

traver();

break;

}

clrscr();

}

getch();

}

Bài 4:

Code

#include<stdio.h>

#include<conio.h>

#include<iostream.h>

#include<string.h>

#include<ctype.h>

typedef struct sinhvien{

int masv;

char ten[30];

float dtb;

};

typedef struct node{

sinhvien info;

node *left,*right;

};

node *head;

int count=0;

void init(){

char *tl="Chua co";

head->info.masv=0;

strcpy(head->info.ten, tl);

head->info.dtb=0;

head->right=NULL;

head->left=NULL;

count=0;

}

node *makenode(sinhvien x){

node *p=new node;

p->info.masv=x.masv;

strcpy(p->info.ten, x.ten);

p->info.dtb=x.dtb;

p->right=NULL;

p->left=NULL;

return p;

}

void insert(node *p,int n){

node *q,*r;

if(n==0){

q=head->right;

head->right=p;

p->right=q;

q->left=p;

p->left=head;

cout<<"Da chen vao dau danh sach";

count++;

return;

}

q=head->right;int i=0;

while(q!=NULL&&i<n){

r=q;

q=q->right;

i++;

}

r->right=p;

p->left=r;

p->right=q;

q->left=p;

cout<<"

Da chen vao vi tri"<<n<<" ";

count++;

}

void remove(int n){

node *p,*q=head,*r;

int i=0;

if(n==0){

p=head->right;

r=p->right;

head->right=r;

r->left=head;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<p->info.masv;

cout<<"

Ho va ten: "<<p->info.ten;

cout<<"

Diem trung binh: "<<p->info.dtb;

getch();

delete p;

count--;

return;

}

if(n>count){

while(q->right!=NULL){

r=q;

q=q->right;

}

r->right=NULL;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

while(i<n){

r=q;

q=q->right;

i++;

}

p=q->right;

r->right=p;

p->left=r;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

void traver1(){

node *q=head->right;

cout<<"

Cac sinh vien trong danh sach gom: ";

while(q!=NULL){

cout<<"

Ma sinh vien: ";

cout<<q->info.masv<<"

";

cout<<"

Ho va Ten: ";

cout<<q->info.ten<<"

";

cout<<"

Diem trung binh: ";

cout<<q->info.dtb<<"

";

q=q->right;

}

getch();

}

void traver2(){

node *t=head->right;

while(t->right!=NULL)

t=t->right;

cout<<"

Cac sinh vien trong danh sach gom: ";

while(t!=head){

cout<<"

Ma sinh vien: ";

cout<<t->info.masv<<"

";

cout<<"

Ho va Ten: ";

cout<<t->info.ten<<"

";

cout<<"

Diem trung binh: ";

cout<<t->info.dtb<<"

";

t=t->left;

}

getch();

}

void main(){

clrscr();

int chon;

sinhvien x;

node *p,ketqua;

while(1){

cout<<"

DANH SACH LIEN KET KEP

";

cout<<"

1. Them mot sinh vien vao dau danh sach";

cout<<"

2. Them mot sinh vien vi tri bat ky";

cout<<"

3. Loai bo sinh vien o dau danh sach";

cout<<"

4. Loai bo sinh vien o vi tri bat ky";

cout<<"

5. Duyet danh sach tu dau xuong cuoi";

cout<<"

6. Duyet danh sach tu cuoi len dau";

cout<<"

z. Thoat";

chon=getch();

chon=toupper(chon);

if(chon=='Z') break;

switch(chon){

case'1':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

insert(p,0);

break;

case'2':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

cout<<"

Nhap vi tri can them: ";

cin>>n;

insert(p,n);

break;

case'3':

remove(0);

break;

case'4':

cout<<"

Nhap vi tri can loai bo: ";

cin>>n;

remove(n);

break;

case'5':

traver1();

break;

case'6':

traver2();

break;

}

clrscr();

}

getch();

}

Lop doi tuong SV

#include<conio.h>

#include<iostream.h>

class sv

{

private: float dtoan,dly,dhoa,dtb;

char ht[30],dc[30];

public:

void nhapsv()

{ Tong hieu so phuc

#include <math.h>

typedef struct tagcomplex {

float thuc, ao;

} complex;

complex tong(complex a, complex

{

complex c;

c.thuc = a.thuc + b.thuc;

c.ao = a.ao + b.ao;

return c;

}

complex hieu(complex a, complex

{

complex c;

c.thuc = a.thuc - b.thuc;

c.ao = a.ao - b.ao;

return c;

}

Phan so

#include "iostream.h"

#include "stdio.h"

#include "conio.h"

//mo ta lop PS

class PS

{

int t,m;

public:

void nhap();

void xuat();

PS cong(PS y); //PS cong(PS'this,PSy)

PS tru(PS y);

friend PS nhan(PS x,PS y);

friend PS chia(PS x,PS y);

};

void PS::nhap()

{

cout<<"nhap tu so"; cin>>t;

cout<<"nhap mau so"; cin>>m;

}

void PS::xuat()

{

cout<<t<<"/"<<m;

}

PS PS::cong(PS y)

{

PS kq;

kq.t=t*y.m+y.t*m;

kq.m=m*y.m;

return kq;

}

PS PS::tru(PS y)

{

PS kq;

kq.t=t*y.m-y.t*m;

kq.m=m*y.m;

return kq;

}

PS nhan(PS x,PS y)

{

PS kq;

kq.t=x.t*y.t;

kq.m=x.m*y.m;

return kq;

}

PS chia(PS x,PS y)

{

PS kq;

kq.t=x.t*y.m;

kq.m=x.m*y.t;

return kq;

}

int main()

{

PS a,b,kq;

cout<<"

nhap ps a:

";

a.nhap();

cout<<"

nhap ps b:

";

b.nhap();

kq=a.cong(b);

cout<<"

tong 2ps:"; kq.xuat();

kq=a.tru(b);

cout<<"

hieu 2ps:"; kq.xuat();

kq=nhan(a,b);

cout<<"

tich 2ps:"; kq.xuat();

kq=chia(a,b);

cout<<"

thuong 2ps:"; kq.xuat();

getch();

}

DSLK SV

#include<stdio.h>

#include<conio.h>

#include<iostream.h>

#include<string.h>

#include<ctype.h>

typedef struct sinhvien{

int masv;

char ten[30];

float dtb;

};

typedef struct node{

sinhvien info;

node *next;

};

node *head;

int count=0;

void init(){

char *tl="Chua co";

head->info.masv=0;

strcpy(head->info.ten, tl);

head->info.dtb=0;

head->next=NULL;

count=0;

}

node *makenode(sinhvien x){

node *p=new node;

p->info.masv=x.masv;

strcpy(p->info.ten, x.ten);

p->info.dtb=x.dtb;

p->next=NULL;

return p;

}

void insert(node *p,int n){

node *q,*r;

if(n==0){

q=head->next;

head->next=p;

p->next=q;

cout<<"Da chen vao dau danh sach";

count++;

return;

}

q=head->next;int i=0;

while(q!=NULL&&i<n){

r=q;

q=q->next;

i++;

}

r->next=p;

p->next=q;

cout<<"

Da chen vao vi tri"<<n<<" ";

count++;

}

void remove(int n){

node *p,*q=head,*r;

int i=0;

if(n==0){

p=head->next;

head->next=p->next;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<p->info.masv;

cout<<"

Ho va ten: "<<p->info.ten;

cout<<"

Diem trung binh: "<<p->info.dtb;

getch();

delete p;

count--;

return;

}

if(n>count){

while(q->next!=NULL){

r=q;

q=q->next;

}

r->next=NULL;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

while(i<n){

r=q;

q=q->next;

i++;

}

p=q->next;

r->next=p;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

void traver(){

node *q=head->next;

cout<<"

Cac sinh vien trong danh sach gom: ";

while(q!=NULL){

cout<<"

Ma sinh vien: ";

cout<<q->info.masv<<"

";

cout<<"

Ho va Ten: ";

cout<<q->info.ten<<"

";

cout<<"

Diem trung binh: ";

cout<<q->info.dtb<<"

";

q=q->next;

}

getch();

}

void main(){

clrscr();

int chon;

sinhvien x;

node *p,ketqua;

while(1){

cout<<"

DANH SACH LIEN KET DON

";

cout<<"

1. Them mot sinh vien vao dau danh sach";

cout<<"

2. Them mot sinh vien vi tri bat ky";

cout<<"

3. Loai bo sinh vien o dau danh sach";

cout<<"

4. Loai bo sinh vien o vi tri bat ky";

cout<<"

5. Duyet danh sach";

cout<<"

z. Thoat";

chon=getch();

chon=toupper(chon);

if(chon=='Z') break;

switch(chon){

case'1':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

insert(p,0);

break;

case'2':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

cout<<"

Nhap vi tri can them: ";

cin>>n;

insert(p,n);

break;

case'3':

remove(0);

break;

case'4':

cout<<"

Nhap vi tri can loai bo: ";

cin>>n;

remove(n);

break;

case'5':

traver();

break;

}

clrscr();

}

getch();

}

Bài 4:

Code

#include<stdio.h>

#include<conio.h>

#include<iostream.h>

#include<string.h>

#include<ctype.h>

typedef struct sinhvien{

int masv;

char ten[30];

float dtb;

};

typedef struct node{

sinhvien info;

node *left,*right;

};

node *head;

int count=0;

void init(){

char *tl="Chua co";

head->info.masv=0;

strcpy(head->info.ten, tl);

head->info.dtb=0;

head->right=NULL;

head->left=NULL;

count=0;

}

node *makenode(sinhvien x){

node *p=new node;

p->info.masv=x.masv;

strcpy(p->info.ten, x.ten);

p->info.dtb=x.dtb;

p->right=NULL;

p->left=NULL;

return p;

}

void insert(node *p,int n){

node *q,*r;

if(n==0){

q=head->right;

head->right=p;

p->right=q;

q->left=p;

p->left=head;

cout<<"Da chen vao dau danh sach";

count++;

return;

}

q=head->right;int i=0;

while(q!=NULL&&i<n){

r=q;

q=q->right;

i++;

}

r->right=p;

p->left=r;

p->right=q;

q->left=p;

cout<<"

Da chen vao vi tri"<<n<<" ";

count++;

}

void remove(int n){

node *p,*q=head,*r;

int i=0;

if(n==0){

p=head->right;

r=p->right;

head->right=r;

r->left=head;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<p->info.masv;

cout<<"

Ho va ten: "<<p->info.ten;

cout<<"

Diem trung binh: "<<p->info.dtb;

getch();

delete p;

count--;

return;

}

if(n>count){

while(q->right!=NULL){

r=q;

q=q->right;

}

r->right=NULL;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

while(i<n){

r=q;

q=q->right;

i++;

}

p=q->right;

r->right=p;

p->left=r;

cout<<"

Loai bo sinh vien: ";

cout<<"

Ma sinh vien: "<<q->info.masv;

cout<<"

Ho va ten: "<<q->info.ten;

cout<<"

Diem trung binh: "<<q->info.dtb;

getch();

delete q;

count--;

return;

}

void traver1(){

node *q=head->right;

cout<<"

Cac sinh vien trong danh sach gom: ";

while(q!=NULL){

cout<<"

Ma sinh vien: ";

cout<<q->info.masv<<"

";

cout<<"

Ho va Ten: ";

cout<<q->info.ten<<"

";

cout<<"

Diem trung binh: ";

cout<<q->info.dtb<<"

";

q=q->right;

}

getch();

}

void traver2(){

node *t=head->right;

while(t->right!=NULL)

t=t->right;

cout<<"

Cac sinh vien trong danh sach gom: ";

while(t!=head){

cout<<"

Ma sinh vien: ";

cout<<t->info.masv<<"

";

cout<<"

Ho va Ten: ";

cout<<t->info.ten<<"

";

cout<<"

Diem trung binh: ";

cout<<t->info.dtb<<"

";

t=t->left;

}

getch();

}

void main(){

clrscr();

int chon;

sinhvien x;

node *p,ketqua;

while(1){

cout<<"

DANH SACH LIEN KET KEP

";

cout<<"

1. Them mot sinh vien vao dau danh sach";

cout<<"

2. Them mot sinh vien vi tri bat ky";

cout<<"

3. Loai bo sinh vien o dau danh sach";

cout<<"

4. Loai bo sinh vien o vi tri bat ky";

cout<<"

5. Duyet danh sach tu dau xuong cuoi";

cout<<"

6. Duyet danh sach tu cuoi len dau";

cout<<"

z. Thoat";

chon=getch();

chon=toupper(chon);

if(chon=='Z') break;

switch(chon){

case'1':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

insert(p,0);

break;

case'2':

cout<<"

Nhap thong tin cua sinh vien can them: ";

cout<<"

Ma sinh vien: ";

cin>>x.masv;

cout<<"

Ten: ";

fflush(stdin);gets(x.ten);

cout<<"

Diem trung binh: ";

cin>>x.dtb;

p=makenode(x);

cout<<"

Nhap vi tri can them: ";

cin>>n;

insert(p,n);

break;

case'3':

remove(0);

break;

case'4':

cout<<"

Nhap vi tri can loai bo: ";

cin>>n;

remove(n);

break;

case'5':

traver1();

break;

case'6':

traver2();

break;

}

clrscr();

}

getch();

}

Lop doi tuong SV

#include<conio.h>

#include<iostream.h>

class sv

{

private: float dtoan,dly,dhoa,dtb;

char ht[30],dc[30];

public:

void nhapsv()

{ HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<"nhap ho ten:";

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin.ignore();

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin.get(ht,30);

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"nhap dia chi:";

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin.ignore();

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin.get(dc,30);

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"nhap diem toan:";

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin>>dtoan;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"nhap diem ly:";

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin>>dly;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"nhap diem hoa:";

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin>>dhoa;

}

float trungbinh()

{ dtb=(dtoan+dly+dhoa)/3;

return dtb;

}

void xuat()

{ HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<"ho ten:"<<ht;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"dia chi:"<<dc;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"diem toan:"<<dtoan;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"diem ly:"<<dly;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"diem hoa:"<<dhoa;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"diem trung binh:"<<trungbinh();

if(dtb<=4.0)

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"yeu";

else if(dtb>4.0&&dtb<6.5)

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"trung binh";

else if(dtb>=6.5&&dtb<8.0)

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"kha";

else

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"gioi";

}

};

sv svx[100],svt;

void main()

{

int n,i,j;

clrscr();

do{ HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<"nhap so sinh vien:";

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin>>n;

}while(n<0);

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"NHAP THONG TIN SINH VIEN";

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

{ HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"nhap sinh vien thu "<<i<<"."<<endl;

svx[i].nhapsv();

}

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

{ HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<"sinh vien thu" <<i<<"."<<endl;

svx[i].xuat();

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl;

}

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

for(j=i+1;j<n;j++)

if(svx[i].trungbinh()>svx[j].trungbinh())

{svx[i]=svt;

svx[i]=svx[j];

svx[j]=svt;

}

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<"sinh vien co diem trung binh cao nhat la:";

svx[n-1].xuat() ;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl<<"danh sach sv duoc sap theo chieu tang dan cua dtb";

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

{ HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<"sinh vien thu" <<i<<"."<<endl;

svx[i].xuat();

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout<<endl;

}

getch();

}

Lop DAte

#include<conio.h>

#include<iostream.h>

class Date //lop ngay

{

int Day;//ngay

int Month;//thang

int Year;//nam

public:

void Input();//Ham nhap mot ngay

void Init(int d,int m,int y);//khoi tao 1 ngay

int IsValid();//Kiem tra tinh hop le cua mot ngay

void Nextday(Date& next);//tinh ngay tiep theo

void Output();//xuat 1 ngay ra man hinh

};//ket thuc dinh nghia lop

void Date::Input()

{

cout<<"Xin nhap vao ngay:";

cin>>Day;

cout<<"

Xin nhap vao thang:";

cin>>Month;

cout<<"

Xin nhap vao nam:";

cin>>Year;

}

void Date::Init(int d,int m,int y)

{

Day=d;

Month=m;

Year=y;

}

int Date::IsValid()//Ham kiem tra tinh hop le cua 1 ngay don gian

{

if(Day<=30&&Day>0&&Month<=12&&Month>0)

return 0;

else

return 1;

}

void Date::Nextday(Date& next)//Don gian 1 thang co 30 ngay

{

if(next.Day==30)

{

Day=1;

Month++;

}

else

Day++;

}

void Date::Output()

{

cout<<Day<<"-"<<Month<<"-"<<Year;

}

void main()

{

clrscr();

Date d1,d2;

cout<<"Nhap vao ngay thu nhat.

";

d1.Input();

d2.Init(10,10,1985);

//Kiem tra va xuat ra man hinh

if(d1.IsValid())

cout<<"Ngay khong hop le.";

else

{

cout<<"

Ngay thu 1 la:";

d1.Output();

cout<<"

Ngay tiep theo cua ngay:";

d1.Output();

d1.Nextday(d1);

cout<<" la ngay:";

d1.Output();

}

if(d2.IsValid())

cout<<"Ngay khong hop le.";

else

{

cout<<"

Ngay thu 2 la:";

d2.Output();

cout<<"

Ngay tiep theo cua ngay:";

d2.Output();

d2.Nextday(d2);

cout<<" la ngay:";

d2.Output();

}

getch();

}

Queue

#include <iomanip.h>

#define nMax 9

class Queue { int Info[nMax];

int First, Last;

public:

Queue(){First=Last=-1;}

int Empty();

int Overflow();

int Delete();

void Add(int);

void List();

void Create();

};

int Succ(int k) {return (k+1) % nMax;}

int Queue:: Empty() { return (First==-1 && Last==-1)?1:0;}

int Queue:: Overflow() { return Succ(First) ==Last?1:0;}

int Queue:: Delete()

{ int p=Info[Last]; Last=Succ(Last);

if (Succ(First) ==Last) First=Last=-1;

return p;

}

void Queue:: Add(int x)

{ if(Empty()) {First=Last=0;}

else First=Succ(First);

Info[First]=x;

}

void Queue:: List()

{ int k=Last;

while (!Empty()) HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout <<setw(8)<<Delete();

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout <<endl;

Last=k;

}

void Queue:: Create()

{ int x;

HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout <<"De ket thuc, nhap 0"<<endl;

do { HYPERLINK "http://www.cplusplus.com/reference/iostream/cout.html" \t "_blank" cout <<"New value: ";

HYPERLINK "http://www.cplusplus.com/reference/iostream/cin.html" \t "_blank" cin >> x;

if(!Overflow() && x!=0) Add(x);

} while (!Overflow() && x!=0);

}

void main()

{ Queue q;

q.Create();

q.List();

}

Tam giác

#include<stdio.h>

#include<conio.h>

#include <math.h>

// khai bao kieu diem va tam giac

typedef struct

{

int x;

int y;

}DIEM;

typedef struct

{

DIEM dA;

DIEM dB;

DIEM dC;

}TAMGIAC;

//nguyen mau ham

void NhapDiem(DIEM &d);

void XuatDiem(DIEM d,char *thongbao);

float TinhKhoangCach(DIEM d1,DIEM d2);

void NhapTamGiac(TAMGIAC &tg);

void XuatTamGiac(TAMGIAC tg,char *thongbao);

float TinhChuVi(TAMGIAC tg);

float TinhDienTich(TAMGIAC tg);

void main()

{

TAMGIAC tg;

NhapTamGiac(tg);

XuatTamGiac(tg,"toa do ba diem cua tam giac:

");

printf("chu vi tam giac =%.2f

",TinhChuVi(tg));

printf("Dien tich tam giac =%.2f

",TinhDienTich(tg));

}

// dinh nghia ham

void NhapDiem(DIEM &d)

{

printf("nhap hoanh do x:");

scanf("%d",&d.x);

printf("nhap tung do y:");

scanf("%d",&d.y);

}

void XuatDiem(DIEM d,char *thongbao)

{

printf("%s",thongbao);

printf("(%d,%d)

",d.x,d.y);

}

float TinhKhoangCach(DIEM d1,DIEM d2)

{

float kg;

int dx = d1.x - d2.x;

int dy = d1.y - d2.y;

kg = (float)sqrt((dx*dx + dy*dy));

return kg;

}

void NhapTamGiac(TAMGIAC &tg)

{

printf("Nhap toa do DIEM A:

");

NhapDiem(tg.dA);

printf("Nhap toa do DIEM B:

");

NhapDiem(tg.dB);

printf("Nhap toa do diem C:

");

NhapDiem(tg.dC);

}

void XuatTamGiac(TAMGIAC tg,char *thongbao)

{

printf("%s", thongbao);

XuatDiem(tg.dA,"-Toa do DIEM A: ");

XuatDiem(tg.dB,"-Toa do DIEM B: ");

XuatDiem(tg.dC,"-Toa do DIEM C: ");

}

float TinhChuVi(TAMGIAC tg)

{

float P,AB,AC,BC;

AB = TinhKhoangCach(tg.dA,tg.dB);

AC = TinhKhoangCach(tg.dA,tg.dC);

BC = TinhKhoangCach(tg.dB,tg.dC);

P = AB + AC + BC;

return P;

}

float TinhDienTich(TAMGIAC tg)

{

float s,p,AB,AC,BC;

AB = TinhKhoangCach(tg.dA,tg.dB);

AC = TinhKhoangCach(tg.dA,tg.dC);

BC = TinhKhoangCach(tg.dB,tg.dC);

p=(AB +AC +BC)/2;

s = (float)sqrt(p*(p- AB)*(p-AC)*(p-BC));

return s;

}

Stack

#include<stdio.h>

#include<conio.h>

#include<malloc.h>

typedef int ElementType;

typedef struct Node

{

ElementType Element;

Node* Next;

};

typedef Node* Stack;

void MAKENULL_STACK(Stack* S)

{

(*S)=(Node*) HYPERLINK "http://cppreference.com/stdmem/malloc.html" \t "_blank" malloc(sizeof(Node));

(*S)->Next=NULL;

}

int EMPTY_STACK(Stack S)

{

return S->Next==NULL;

}

ElementType TOP(Stack S)

{

if(!EMPTY_STACK(S))

return S->Next->Element;

};

void PUSH(ElementType X, Stack *S)

{

Node* P;

P=(Node*) HYPERLINK "http://cppreference.com/stdmem/malloc.html" \t "_blank" malloc(sizeof(Node));

P->Element=X;

P->Next=(*S)->Next;

(*S)->Next=P;

}

void POP(Stack* S)

{

Node* Temp;

Temp=(*S)->Next;

(*S)->Next=(*S)->Next->Next;

HYPERLINK "http://cppreference.com/stdmem/free.html" \t "_blank" free(Temp);

}

/*void NHAP(Stack *S)

{

printf("

Nhap so luong phan tu: ");

scanf("%d",&n);

printf("

");

MAKENULL_STACK(&*S);

while(n>0)

{

ElementType X;

printf("Nhap vao mot gia tri: ");

scanf("%d",&X);

PUSH(X,S);

n--;

}

} */

void NHAPSONGUYEN(int n, Stack *S)

{

HYPERLINK "http://cppreference.com/stdio/printf.html" \t "_blank" printf("

Nhap vao mot con so: ");

HYPERLINK "http://cppreference.com/stdio/scanf.html" \t "_blank" scanf("%d",&n);

MAKENULL_STACK(&*S);

while(n>0)

{

PUSH(n%2,&*S);

n/=2;

}

}

void XUAT(Stack *S)

{

if(!EMPTY_STACK(*S))

{

while(!EMPTY_STACK(*S))

{

HYPERLINK "http://cppreference.com/stdio/printf.html" \t "_blank" printf("%d ",TOP(*S));

POP(&*S);

}

}

else

HYPERLINK "http://cppreference.com/stdio/printf.html" \t "_blank" printf("

Stack rong!");

}

int main()

{

Stack S;

//NHAP(&S);

NHAPSONGUYEN(n,&S);

XUAT(&S);

getch();

return 0;

}

LÛp SV

// quan li hoc sinh

# include<iostream.h>

# include<stdio.h>

class hs

{ private:

char ten[50];

int diem;

public:

void nhap_diem()

{ cout<<"Nhap diem:";

cin>>diem;

}

void nhap_ten()

{ cout<<"Nhap ten:";

}

int xuat_diem()

{ cout<<diem;

}

void xuat_ten()

{ puts(ten);

}

};

class danh_sach

{ private:

hs *list;

public:

void nhap();

void sap_xep();

};

void danh_sach::nhap()

{ cout<<"Nhap so hoc sinh la :";

cin>>n;

list=new hs[n];

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

{ cout<<"Nhap du lieu cho hoc sinh :"<<i<<endl;

list[i].nhap_ten();

list[i].nhap_diem();

}

}

void danh_sach::sap_xep()

{ int A[100];

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

/ 0 7 8 î ô

ä

å

æ

í

î

""œ ¢)) )))))ùòêÜùÒÂ'Â'°¬ùò¢šŠwg¢š'ù'N#hH }B*

CJ OJQJ^JaJ phi

hl\ 5�>*-hl\ B*CJOJQJaJph%hl\ 5�B*CJOJQJ\�aJph-hl\ B*CJ OJQJaJ phhl\ B*phhl\ 0JB*phhªMãhùnFhùnF0JCJ OJQJaJ -hùnFB*CJ OJQJaJ phhùnFhªMã5�>*hùnFhªMã5�>*B*ph333hªMãB*ph333

hªMã5�>*

hö/5�>*%&BR]^�Œ¦ºÄÆÇèêõ # - / 0 ýýÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ/$d%d&d'd-DMÆ

ÿÿÿÿNÆÿOÆÿPÆÿQÆÿgdªMã

Íý0 8 å

æ

î

'

:

L



Ž

£

³

À

Ã

Ï

Ü

é

þ

/ ýýýýÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ / B T ^ ' | � ¥ Â Ö å ð ò &'7GTy„Ž'¨ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ ¨¾ÅÒÙÜèô&(<Q[fvŒ­Øÿ,7CNXÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ X[i�‰-›«Ì÷KVbmwz‡Ž›¢¥±½ÝÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ Ý -Ycnx�ƒ'§Øé # = Y y • ¢ ¥ ¯ ± ¾ É ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ É Ô Ü é ú 4jœÏ#:J'w‡"Ëêû0RÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ Rbu†'�Õô:\l¦²ÃÎÚéôõ+7ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ 7FQ]kvz...ˆ'"œ¢'ÆÛî$3?BÐÐÐÐÐÐÐÐÐÐ˾ÐÐÐÐÐÐÐÐÐÐ

-D'MÆ

ÿÒîÿgdl\ gdl\ /$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ BWg{~Š-¤¹Íêý)35Qdz-«»ÑÜÞÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ Þú $5C^n"ž¨«ÃÙàîõø%8'ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ 'jl€•Ÿª»×è'Ry¦±½ÈÒÕãü---ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ -(-I-t-›-È-Ó-ß-ê-ô-÷-

# 0 = P p š À ì ö !ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ !

! !!&!<!m!~!›!¸!Ò!î! "*"8";"E"G"W"m"„"'"Ã"Ô"ñ"ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ ñ" #(#D#d#€#�#�#š#œ#�#ª#µ#À#È#Õ#æ#ï#ú# $V$ˆ$»$î$!%ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ !%R%i%y%�%¦%¶%Â%ú%&*&@&_&�&'&¤&µ&À&Ì&'#'4'J'i'‹'ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ ‹'›'®'Õ'á'ò'ý' ((#($(0(Z(f(u(€(Œ(›(¦(²(Á(è(ì(÷(ú(ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ ú()) ))¬9­9¶92?3?9?:?)E*E3E4E9M:MU U VVÐÐÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ/$d%d&d'd-D'MÆ

ÿòúÿNÆ®áÿOÆ®áÿPÆ®áÿQÆ®áÿgdl\ ))*)>)?)D)K)R)S)T)Y)l)m)o)s)�)‚)„)Š)‹)Ž)')Ÿ) )ï)ð)ô)õ)÷)**

*

*Y*Z*]*^*_*íÛíÆíÆ'íÆí'íÆí'íÆ'íÆí�í�‰�we'í�í�‰�í#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B*

CJ OJQJ^JaJ ph€€)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*

CJ OJQJ^JaJ phi#hH }B*CJ OJQJ^JaJ ph$_*e*g*h*l*m*»*¼*¿*À*Á*Ä*Ë*Ì*Ð*Ñ* +!+%+&+(+,+.+=+>+B+C+'+'+•+-+-+�+Ÿ+ +¤+¥+ó+ô+÷+ø+íÛÉÛ²Û²ž²ÛŒÛÉÛ²Û²ž²zÛzhÉÛ²Û²ž²ÛíÛÉÛ²Û²ž²#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€#hH }B*CJ OJQJ^JaJ phø^'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*CJ OJQJ^JaJ ph#hH }B* CJ OJQJ^JaJ ph,‰(ø+ù+ü+,,, ,X,Y,],^,',d,f,w,x,|,},Ë,Ì,Ï,Ð,Ò,×,Ø,Ü,Ý,,---1-2-4-8-:-I-J-N-O-�-ž-¡-¢-¤-§-¨-¬-­-ü-ý-íÛíÉí²í²ž²ŒíŒzÉí²í²ž²ŒíÉí²í²ž²ŒíŒzÉí²í²ž²ŒíÉí²í²#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*CJ OJQJ^JaJ phø^#hH }B*CJ OJQJ^JaJ ph0ý-....

...-. .n.o.r.s.u.y.z.€.....™.š. .¡.¤.¥.ª.«.¬.­.².¸.¼.½.ëÔ°žŒ°Ô°ÔëÔ°Œ°w°Â°e°e°eSŒ°w°Œ#hH }B*CJ OJQJ^JaJ phÿ#hH }B* CJ OJQJ^JaJ ph@)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*

CJ OJQJ^JaJ phˆ#hH }B*CJ OJQJ^JaJ ph#hH }B* CJ OJQJ^JaJ ph€,jhH }B*CJ OJQJU^JaJ ph'hH }0JB* CJ OJQJ^JaJ ph,‰ ½.Â.Æ.Ð.Ñ. /!/%/&/(/1/3/5/6/9/:/‰/Š/Ž/�/'/•/-/¡/£/¥/¦/©/ª/ù/ú/þ/ÿ/00 000000-0n0o0s0t0v0íØíÁíÁ­Á›‰›íwíÁíÁ­Á›í›‰›íwíÁíÁ­Á›í›‰›íwíÁíÁ­Á›#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*CJ OJQJ^JaJ ph.v0z0|0†0ˆ0‹0Œ0�0�0ß0à0ä0å0ç0ë0í0ø0ú0þ0ÿ011R1S1W1X1Z1^1'1r1t11€1ƒ1...1‰1‹1'1"1â1ã1ç1è1ê1î1ð1õ1íÛÉÛí·í í Œ ÛíÛÉÛí·í í Œ ÛíÛÉÛí·íwíÛí í Œ ÛíÛÉ)hH }5�B*CJ OJQJ\�^JaJ ph Ø'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€#hH }B*CJ OJQJ^JaJ ph.õ1ö1ù1ý1þ12222

2

2 222e2f2j2k2m2q2s22€2ƒ2‡2ˆ2Š2Ž2�2"2•2˜2™2 2¡2ð2ñ2õ2ö2ø2íÛÆÛÆÛ'Û¢Û'Û‹Û‹w‹'Û'eíÛÆÛÆÛ'Û¢Û'Û‹Û‹w‹'#hH }B*

CJ OJQJ^JaJ phˆ'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B* CJ OJQJ^JaJ ph@#hH }B* CJ OJQJ^JaJ ph€)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*CJ OJQJ^JaJ ph#hH }B*

CJ OJQJ^JaJ ph€€'ø2ü2þ233 3

3 33^3_3c3d3f3j3l3r3s3x3y3Š3‹3Œ3�3œ3Ÿ3¥3¦3±3²3¶3¸3¹3º3 4

4 444%4&4,4-4{4|44€4íÛÉ·í¢í‹í‹w‹ÛíÛÉ·í·í·í¢í¢í·í·í¢í‹í‹w‹ÛÉ·í‹í‹w‹'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€#hH }B*CJ OJQJ^JaJ ph.€4‚4ƒ4„4Š4�4'4'4"4•4™4š4é4ê4î4ï4ñ4õ4÷4555555555-5 5!5"5$5íÛÉÛ'ÛíÛÉÛ�Û�‰�íÛíwÉÛ'ÛíeÉÛíÛÉÛS#hH }B* CJ OJQJ^JaJ ph@#hH }B*CJ OJQJ^JaJ phÿ#hH }B*

CJ OJQJ^JaJ phˆ'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*CJ OJQJ^JaJ ph#hH }B* CJ OJQJ^JaJ ph€ $5*5+5z5{55€5‚5†5ˆ5�5Ÿ5 5¢5¥5§5«5¬5¸5¾5À5Á5É5Ì5Î5Ï5Ð5Ñ5Ò5Ó5Ô5Õ5Ö5íÖíÖÂÖ°í°ž°í°ž°íŒízíŒíeí°SŒí°íŒí#hH }B*CJ OJQJ^JaJ phÿ)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*CJ OJQJ^JaJ phø^#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B*CJ OJQJ^JaJ ph Ö5Ø5Ý5Þ5-6.6263656D6E6G6H6J6M6O6S6T6_6c6e6f6j6k6º6»6¿6À6Â6Æ6Ç6Î6Ñ6íÛÄÛÄ°ÄžŒÛžÛžŒžÛzÛhÛzÛÄÛÄ°ÄžÛzÛS)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*CJ OJQJ^JaJ phø^#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B*CJ OJQJ^JaJ ph#hH }B* CJ OJQJ^JaJ ph@ Ñ6Ó6Ô6Õ6Ö6×6Ø6Ù6Ú6Û6Ü6Ý6ß6ä6ç6é6ê6ë6ì6í6î6ï6ð6ñ6ò6ó6õ6û6ý67 7777!707174757A7B7H7I7U7V7Y7Z7e7íÛÉ·íÛí¥É·í¥í�íÛí¥É·íÛí·í¥í�í~íÛí~íÛí·íÛí·íÛí·í#hH }B*CJ OJQJ^JaJ phø^)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B* CJ OJQJ^JaJ ph@#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*CJ OJQJ^JaJ phÿ#hH }B* CJ OJQJ^JaJ ph€#hH }B*CJ OJQJ^JaJ ph/e7f7µ7¶7º7»7½7è7é7ò7ó7ö7ú7ý7þ788R8S8W8X8Z8^8'8"8"8˜8›8�8ž8é×éÃ鱟�×{×i×�×é×éÃé±×±Ÿ�×T×±)hH }5�B*CJ OJQJ\�^JaJ ph Ø#hH }B*CJ OJQJ^JaJ phø^#hH }B* CJ OJQJ^JaJ ph@#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*

CJ OJQJ^JaJ phˆ#hH }B* CJ OJQJ^JaJ ph€'hH }0JB* CJ OJQJ^JaJ ph,‰#hH }B*CJ OJQJ^JaJ ph,jhH }B*CJ OJQJU^JaJ phž8Ÿ8 8¡8¢8£8¤8¥8§8­8®8ý8þ8999 999999-9#9$909496979<9=9Œ9�9'9íÛÉ·ÉÛɥɎɎzŽ·hÉ·É·h·ÉÛÉVÉÛÉŽÉŽz#hH }B*CJ OJQJ^JaJ phø^#hH }B*

CJ OJQJ^JaJ phˆ'hH }0JB* CJ OJQJ^JaJ ph,‰,jhH }B*CJ OJQJU^JaJ ph#hH }B* CJ OJQJ^JaJ ph@#hH }B* CJ OJQJ^JaJ ph€#hH }B*CJ OJQJ^JaJ ph#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*CJ OJQJ^JaJ phÿ!'9'9"9˜9™9¨9©9­9µ9¶92?3?8?9?:?N?O?]?^?é×ųųŬ¥•...r\...J8J8#hGx'B*CJ OJQJ^JaJ ph#hGx'B*

CJ OJQJ^JaJ phi+hGx'hGx'5�>*B*CJ OJQJaJ ph%hö/5�>*B*CJ OJQJaJ ph-hGx'B*CJ OJQJaJ ph-hH }B*CJ OJQJaJ ph

hH }5�>*

hö/5�>*#hH }B*

CJ OJQJ^JaJ ph€€#hH }B*CJ OJQJ^JaJ ph#hH }B* CJ OJQJ^JaJ ph€,jhH }B*CJ OJQJU^JaJ ph^?c?l?o?z?{?Š?�?™?š?©?¯?°?Ó?Ô?Ø?Ù?Ú?Û?Ü?ó?ö?þ?ÿ?@@#@$@:@=@F@G@]@a@f@i@j@k@�@...@Œ@�@£@§@°@±@¿@À@Á@Ä@Ê@Í@Ò@Ø@Û@Ü@ß@êØêØÆØêØÆØêÆØ'Ø'¢�ÆØêØÆØêØÆØêØÆØêØêØÆØêØÆØêØÆØÆØêØêØêØ¢Ø#hGx'B*CJ OJQJ^JaJ phÿ#hGx'B* CJ OJQJ^JaJ ph@#hGx'B* CJ OJQJ^JaJ ph€#hGx'B*

CJ OJQJ^JaJ ph€€#hGx'B*CJ OJQJ^JaJ ph)hGx'5�B*CJ OJQJ\�^JaJ ph Ø8ß@à@å@æ@è@ë@ñ@ó@ô@ù@þ@A

A

A AAAAAAAAA-A A!A#A&A,A.A/A7A<ABAOAQAUAVAWAXAYAZA\A_AeAgAhAnAsAvAíÛÉÛ'ÛÉÛ¢Û'Û�íÛíÛ�íÛÉÛÉ~ÉÛ'ÛÉÛ¢Û'Û�ÛÉÛÉ~ÉÛ'ÛÉÛ¢Û'#hGx'B*CJ OJQJ^JaJ phÿ#hGx'B* CJ OJQJ^JaJ ph€#hGx'B*CJ OJQJ^JaJ phø^)hGx'5�B*CJ OJQJ\�^JaJ ph Ø#hGx'B*

CJ OJQJ^JaJ ph€€#hGx'B*CJ OJQJ^JaJ ph#hGx'B* CJ OJQJ^JaJ ph@1vAxAyAƒA„A‰AŠA"A•A˜AšA¨AªAµA¶AºA»A¼A½A¾AÁAÇAÉAÊAÍAÑA×AÙAÚAÝAÞAáAçAéAùAúAþAÿABBB BBBBB*B+B,B-BíÛíÉíÛíÉí'íÛíÛíÛ¢�Éí'íÉí'íÉí~í'í'íÛíÛ�Éí'íÛíÉíÛíÉ#hGx'B*CJ OJQJ^JaJ phø^#hGx'B*CJ OJQJ^JaJ phÿ#hGx'B* CJ OJQJ^JaJ ph@)hGx'5�B*CJ OJQJ\�^JaJ ph Ø#hGx'B*

CJ OJQJ^JaJ ph€€#hGx'B* CJ OJQJ^JaJ ph€#hGx'B*CJ OJQJ^JaJ ph1-B1B5B;B=B>BBBGBJBLBMBQBRBUBZB\B]BfBgB¶B·B»B¼B½B¿BÆBÈBÐBÑBÔBÕB$C%C)C*C+C-C1C2C9CíØíÆí'íØí¢íÆíØí�íyíyeyí¢í¢íÆíyíyeyí¢íÆí'hGx'0JB* CJ OJQJ^JaJ ph,‰,jhGx'B*CJ OJQJU^JaJ ph#hGx'B* CJ OJQJ^JaJ ph@#hGx'B* CJ OJQJ^JaJ ph€#hGx'B*CJ OJQJ^JaJ phø^#hGx'B*

CJ OJQJ^JaJ ph€€)hGx'5�B*CJ OJQJ\�^JaJ ph Ø#hGx'B*CJ OJQJ^JaJ ph'9C:C;C<C?CCCICKCLCRCWCZC\C]C'CaC°C±CµC¶C·C¹CÎCÐCÔCÕCØCÚCÝCÞC-D.D2D3D4D6DCDDDLDMDíÛÉÛ'ÛÉÛ¢Û'ÛÉÛ‹Û‹w‹ÛíeíÛÉÛ'Û‹Û‹w‹ÛíeÉÛ‹#hGx'B*

CJ OJQJ^JaJ phˆ'hGx'0JB* CJ OJQJ^JaJ ph,‰,jhGx'B*CJ OJQJU^JaJ ph#hGx'B*CJ OJQJ^JaJ phø^)hGx'5�B*CJ OJQJ\�^JaJ ph Ø#hGx'B*

CJ OJQJ^JaJ ph€€#hGx'B*CJ OJQJ^JaJ ph#hGx'B* CJ OJQJ^JaJ ph€'MD›DœDŸD D¡D£D¥D¦D®D°D±D²D½D¿DÁDÂDÃDÌDÍDÕDÚDÜDÝDèDêDìDíDîDðDñDõDùD

E

EEEEEEíÖÂÖí°íží‰íwíwíw°íží‰íwíwíw°íží‰ížíeíží#hGx'B*CJ OJQJ^JaJ phø^#hGx'B* CJ OJQJ^JaJ ph@)hGx'5�B*CJ OJQJ\�^JaJ ph Ø#hGx'B*

CJ OJQJ^JaJ ph€€#hGx'B* CJ OJQJ^JaJ ph€'hGx'0JB* CJ OJQJ^JaJ ph,‰,jhGx'B*CJ OJQJU^JaJ ph#hGx'B*CJ OJQJ^JaJ ph'E"E$E%E)E4EEEFEWEXEiEjEƒE†E‡E‹EŒE"E"EšE¡E¤E¦E§E¬E¯E±E²E¹EºE»EÂEÃEÉEíÛÉÛ·¥·¥·¥·�}�}·h·h·h·V·h·V·V·h·h#hùnFB*

CJ OJQJ^JaJ ph€€)hùnF5�B*CJ OJQJ\�^JaJ ph Ø$hùnF0J6�CJ OJQJ]�^JaJ )hùnF6�B*

CJ OJQJ]�^JaJ ph€#hùnFB*

CJ OJQJ^JaJ phi#hùnFB*CJ OJQJ^JaJ ph#hGx'B*

CJ OJQJ^JaJ ph€€#hGx'B*CJ OJQJ^JaJ ph#hGx'B*CJ OJQJ^JaJ phø^!ÉE×EØEäEåEñEòEüEýEÿEFF F#F$F&F'F(F,F=FAFBFCFLFMFNFSFsFtFuFyFŽF�F'F"F"F˜F°F'FµF¶F¿FÀFÁFÆFÜFÝFÞFãFüFýFÿFG G!G5G6GJGíÛíÛíÛíÛíÆí±íŸíÛí±í±íŸíÛí±íÛí±íŸíÛí±í±íŸíÛí±íÛí±íÛí±íÛíÛí#hùnFB* CJ OJQJ^JaJ ph@)hùnF5�B*CJ OJQJ\�^JaJ ph Ø)hùnF6�B*

CJ OJQJ]�^JaJ ph€#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB*CJ OJQJ^JaJ ph9JG^GaGbGfGgGiGjGkGlG}G...GˆG‰G�G"G•G-G¥G¦G²G½GÀGÁGÅGËGÍGÎGàGáGéGúGûGÿG HH-H1H2H3H>HBHCHíÝíÝíËí¹§¹íÝíÝíËí¹§¹íÝíÝíËí¹§¹'¹}¹k¹í¹§¹í¹#hùnFB* CJ OJQJ^JaJ ph@)hùnF5�B*CJ OJQJ\�^JaJ ph Ø)hùnF6�B*

CJ OJQJ]�^JaJ ph€#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB*CJ OJQJ^JaJ ph#hùnFB*

CJ OJQJ^JaJ phf™hùnF0JCJ OJQJ^JaJ #hùnFB*

CJ OJQJ^JaJ phˆ*CHDHFHGHHHIHUHfHgHhHsHwHxHyH{H|H}H~H†HŠH›HŸH H¡H¸H¼HÆHÇHÓHÛHÝHÞHáHâHåHæHçHèHðHõHI!I$I%I/I2I6IíÛÉÛ·Û¥Û·Û¥ÛíÛÉÛ·Û�Û�ÛíÛ¥Û·Û¥~¥ÛÉÛÉÛ·Û�Û�Û·Û�Û#hùnFB*

CJ OJQJ^JaJ phf™)hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*

CJ OJQJ^JaJ phˆ#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB*CJ OJQJ^JaJ phø^#hùnFB*CJ OJQJ^JaJ ph#hùnFB* CJ OJQJ^JaJ [email protected];I<I=I>IBICIDIIILIPIQIUIVIWIXI\I]I^IkIlInIsI|I}I€I�I„I...I‰IŠI"IšI�IžI¦IªI¿IÀIÑIåIçIíÛÉÛ·ÛÉ¥Û�ÛíÛÉÛ·ÛÉ¥ÛíÛ�Û·Û·Û·Û¥Û�Û¥Û�Û·Û~l#hùnFB*

CJ OJQJ^JaJ phf™#hùnFB*

CJ OJQJ^JaJ phˆ)hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB* CJ OJQJ^JaJ ph@#hùnFB*CJ OJQJ^JaJ phø^#hùnFB*CJ OJQJ^JaJ ph#hùnFB* CJ OJQJ^JaJ ph€*çIèIéIêIûIýIþIÿI

J-J!J"J#J$J5J7J8J9JEJYJ[J\J]J^JoJqJrJsJvJzJ'J-J-J˜J'J¸JÃJÄJÕJ×JØJêJëJìJýJÿJKKK KíÛÉÛ·ÛÉÛí¥íÛÉÛ·ÛÉÛí¥íÛÉÛ·ÛÉÛ�Û�Û~ÛíÛÉÛ·ÛíÛÉÛ·ÛíÛÉ#hùnFB* CJ OJQJ^JaJ ph@)hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*

CJ OJQJ^JaJ phf™#hùnFB*CJ OJQJ^JaJ phø^#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB*CJ OJQJ^JaJ ph#hùnFB*

CJ OJQJ^JaJ phˆ1 K%K'K(K:K;K<KDKIKfKkKvKwK„K...K˜KšKžK K¡K¢KªK«K¾KÀKÄKÆKÇKÈKÐKÑKäKæKêKìKíKîKõKöKúKûKÿKLLL L LLLLíÛíÉí·í¢í¢í·í�íÛíÛí·í�íÛíÛí·í�íÛíÛí·í�í~í~í·í¢í·í#hùnFB* CJ OJQJ^JaJ ph@#hùnFB* CJ OJQJ^JaJ ph€)hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB*

CJ OJQJ^JaJ phˆ#hùnFB*CJ OJQJ^JaJ phø^#hùnFB*CJ OJQJ^JaJ ph1L-L?LDLQLRLpLqL„L†LŠLŒL�LŽL-L-LªL¬L°L²L³L'L¼L½LÐLÒLÖLØLÙLÚLåLæLêLëLîLïLòLóLôLõLMMM MMMM MMMêØêØÆØ'آآØÆØ'آآØÆØ'آآØÆØ'Ø�Ø�Ø�~ÆØ'ØêØ�Ø�Ø�#hùnFB*CJ OJQJ^JaJ phÿ#hùnFB* CJ OJQJ^JaJ ph@#hùnFB*CJ OJQJ^JaJ phø^#hùnFB* CJ OJQJ^JaJ ph€#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB*CJ OJQJ^JaJ ph)hùnF5�B*CJ OJQJ\�^JaJ ph Ø1MMM-M M"M#M'M(M-M3M5M6M8M9M:M@MQMRMcMdMvMxMM€MƒM'M˜M™MŸMÕMÜMãMèMëMïMÿMNNN'NaNíÛíÛíÛíÉí'íÉí­¦­"í"í"í'í'í'í'í'í„í'í„ímím,jhùnFB*CJ OJQJU^JaJ phhùnF0JCJ OJQJ^JaJ #hùnFB*

CJ OJQJ^JaJ ph€

hl\ 5�>*

hùnF5�>*)hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*

CJ OJQJ^JaJ ph€€#hùnFB* CJ OJQJ^JaJ ph@#hùnFB*CJ OJQJ^JaJ ph)aNgNhNiNoN‡N‹N�N'NŸN¤N®N'N¾NÂNÖNÛNåNçNO OO!O6O;O\O]O¡O¢O¨O©OªO°OûOÿOP PZP[P�PžP¢P£P¯P»PÀPØQëÔ­­­Â�­­Â�­­­Â�ÂÔÂÔëÔ­­Â�ÂÔÂÔëÔˆuˆ$hùnF0J6�CJ OJQJ]�^JaJ )hùnF6�B*

CJ OJQJ]�^JaJ ph€hùnF0JCJ OJQJ^JaJ )hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*CJ OJQJ^JaJ ph,jhùnFB*CJ OJQJU^JaJ ph'hùnF0JB* CJ OJQJ^JaJ ph,‰.ØQÙQÝQëQîQòQ÷QRRFRGRMRNRORPRRRhRoRpR²R³R¸R¹RºR¾RáRæR SS(S,S2S7SDSFSeSjS'S'SÕSÖSíØíØíÈí±í±�±í‹y‹í±í±�±í‹íØígíØíÈíØíØí±í±#hùnFB*CJ OJQJ^JaJ phÿ#hùnFB*

CJ OJQJ^JaJ phf™#hùnFB*

CJ OJQJ^JaJ phˆ'hùnF0JB* CJ OJQJ^JaJ ph,‰,jhùnFB*CJ OJQJU^JaJ phhùnF0JCJ OJQJ^JaJ )hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*CJ OJQJ^JaJ ph(ÖSÜSÝSÞSãSTT%T&TiTjTpTqTrTsTuTzT�TˆT‹T™TžT¦T©T±T¼TùTÿTUUVëÔ°›ÂÔÂÔëÔ°‰y°Â›Ây›Âd›ÂRÂ#hùnFB*CJ OJQJ^JaJ phÿ)hùnF6�B*

CJ OJQJ]�^JaJ ph€hùnF0JCJ OJQJ^JaJ #hùnFB*

CJ OJQJ^JaJ phf™)hùnF5�B*CJ OJQJ\�^JaJ ph Ø#hùnFB*

CJ OJQJ^JaJ phˆ#hùnFB*CJ OJQJ^JaJ ph,jhùnFB*CJ OJQJU^JaJ ph'hùnF0JB* CJ OJQJ^JaJ ph,‰VVìYÌÍ Í

ÍíåãåíÙhl\ hùnF5�>*UhÌ@qB*ph#hÌ@qB*CJ OJQJ^JaJ phV8VdVŠVœV¸VÚVôV

W2WfW„WŽW¶WèWXXX.X3XFXVX[X\X_XÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-DMÆ

ÿãëòNÆÿOÆÿPÆÿQÆÿgdÌ@q_XoX}X‹X-X¡X²XÆXÉXàXYY!Y8YnY†YŸY¥Y§YÁYÔYìYÌ4ÌNÌÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ/$d%d&d'd-DMÆ

ÿãëòNÆÿOÆÿPÆÿQÆÿgdÌ@q A[i]=list[i].xuat_diem();

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

for(int j=i+1;j<n;j++)

if(A[i]>A[j])

{ int t=A[i];

A[i]=A[j];

A[j]=t;

}

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

cout<<A[i]<<' ';

}

void main()

{ danh_sach p;

p.nhap();

p.sap_xep();

}

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

Tags: #lampro