| Thư viện mã nguồn - Ứng dụng C/C+/VC+ Tổng hợp thư viện mã nguồn C/C+/VC+ giúp bạn tham khảo, học tập C/C+/VC+ dễ dàng |
Bảng tin "Lập Trình Việt"
|
| THÔNG BÁO MỚI NHẤT |
CUỘC THI LẬP TRÌNH ONLINE TỔ CHỨC VÀO THỨ BẢY 7H TỐI HẰNG TUẦN |
![]() |
| | #1 (permalink) | |
![]() Status: Tham gia ngày: Feb 2009 Tuổi: 25 Bài gởi: 327
Thanks: 90
Thanked 79 Times in 62 Posts
| chương trình này mình sưu tầm thui, ko phải viết đâu nha hi vọng giúp ích dc các bạn ![]() Mã: //Chuong trinh chinh
void main()
{
int x,vt;
int chon;
clrscr();//Xoa khong cho hien thi text chon chuc nang thu 16
Volume(); // Goi am thanh
textcolor(10); //Tao mau chu
cout<<endl<<"\nChuong Trinh Sap Xep Theo Cac Thuat Toan & Tim Kiem Tung Phan Tu";
cout<<endl<<"\nHo & Ten: DO MINH TAN";
cout<<endl<<"\nLop: CN1-K4";
cout<<endl<<"\nThuc hien: 5/2007";
cout<<endl<<endl;
cout<<"Chuong trinh dang chay"; delay(500);
sound(1000);
delay(150);
nosound();
cout<<"."; delay(500); sound(1000); delay(100); nosound();
cout<<"."; delay(500); sound(1000); delay(100); nosound();
cout<<"."; delay(500); sound(1000); delay(100); nosound();
cout<<"."; delay(500); sound(1000); delay(100); nosound();
cout<<"."; delay(500); sound(1000); delay(100); nosound();
cout<<"."; delay(500); sound(1000); delay(100); nosound();
cout<<"."; delay(500); sound(1000); delay(100); nosound();
cout<<"."; delay(500); sound(1500); delay(350); nosound();
cout<<"OK"; delay(500);
do
{
menu();
chon = chon_menu();
switch(chon)
{
case 1: clrscr();
sound(350);
delay(150);
nosound();
cout<<"Hay nhap vao so phan tu (1->20): ";
cin>>n;
cout<<endl;
if((n>0)&&(n<=20))
{
input(a,n);
cout<<"\nDay vua nhap la: ";
output(a,n);
}
else cout<<endl<<"Khong hop le !...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 2: clrscr();
sound(350);
delay(150);
nosound();
cout<<"Nhap so phan tu can sinh ra (1->20): ";
cin>>n;
if((n>0)&&(n<=20))
{
cout<<endl<<"Day duoc sinh ra la: ";
cout<<endl<<endl;
randomize();
for(int i=0;i<=n;i++) a[i]=random(1000);
//So ngau nhien tu 0->1000
output(a,n);
}
else cout<<endl<<"Khong hop le !...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 3: clrscr();
sound(350);
delay(150);
nosound();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\n---Tim kiem theo PP LinearSearch---";
cout<<endl;
cout<<"\nNhap phan tu can tim: ";
cin>>x;
clrscr();
vt = LinearSearch(a,n,x);
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
if (vt ==-1) cout<<endl<<"\nKhong co phan tu can tim !";
else
{
cout<<endl<<"Co phan tu can tim !"<<endl;
cout<<endl<<"La so: "<<x;
cout<<endl<<"\nTai vi tri thu: "<<vt;
}
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 4: clrscr();
sound(350);
delay(150);
nosound();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\n---Tim kiem theo PP BinarySearch---";
cout<<endl;
cout<<"\nNhap phan tu can tim: ";
cin>>x;
clrscr();
cout<<endl;
vt = BinarySearch(a,n,x);
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
if (vt == -1) cout<<endl<<"\nKhong co phan tu can tim !";
else
{
cout<<endl<<"Co phan tu can tim !"<<endl;
cout<<endl<<"La so: "<<x;
cout<<endl<<"\nTai vi tri thu: "<<vt;
}
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 5: clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP InsertionSort:"<<endl;
cout<<endl;
InsertionSort(a,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 6: clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP SelectionSort:"<<endl;
cout<<endl;
SelectionSort(a,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 7: clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP InterchangerSort:"<<endl;
cout<<endl;
InterChangeSort(a,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 8: clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP BubbleSort:"<<endl;
cout<<endl;
BubbleSort(a,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 9: clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP ShakerSort:"<<endl;
cout<<endl;
ShakerSort(a,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 10:clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP HeapSort:"<<endl;
cout<<endl;
HeapSort(a,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 11:clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP BInsertionSort:"<<endl;
cout<<endl;
BInsertionSort(a,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 12:clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP ShellSort:"<<endl;
cout<<endl;
ShellSort(a,n,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 13:clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP QuickSort:"<<endl;
cout<<endl;
QuickSort(a,1,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 14:clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP MergeSort:"<<endl;
cout<<endl;
MergeSort(a,1,n);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 15:clrscr();
if(n>0)
{
cout<<"Day ban dau: ";
output(a,n);
cout<<endl;
cout<<"\nSap xep theo PP RadixSort:"<<endl;
cout<<endl;
RadixSort(a,n,4);
output(a,n);
}
else cout<<"Chua co gi ?...Quay ve Menu !";
sound(700);
delay(150);
nosound();
getch();
break;
case 16:clrscr();
sound(1000);//Am thanh bao chuan bi ket thuc
delay(100);
nosound();
cout<<"\nDang thoat khoi chuong trinh !";
cout<<"."; delay(150); cout<<"."; delay(150);
cout<<"."; delay(150); cout<<"."; delay(150);
cout<<"."; delay(150); cout<<"."; delay(150);
cout<<"."; delay(150); cout<<"."; delay(150);
cout<<"."; delay(150); cout<<"."; delay(150);
cout<<"."; delay(150); cout<<"."; delay(150);
cout<<endl<<endl;
cout<<"Nhan mot phim bat ki !";
sound(1000); //Am thanh ket thuc chuong trinh
delay(500);
nosound();
getch();
exit(1);
}
}
while (1);
}
| |
| | |
| Những "Lập Trình Viên" đã cảm ơn thucnq vì bài viết hay: | Administrator (08-02-2010) |
5 Chủ đề mới nhất của thucnq
| |||||
| Chủ đề | Chuyên mục | Người gởi sau cùng | Trả lời | Lần đọc | Bài mới gửi |
| | Bài tập lớn - Đồ án - ebook PHP | thucnq | 0 | 665 | 25-05-2010 10:14 AM |
| | Bài tập lớn - Đồ án - ebook Pascal/Delphi | thucnq | 0 | 188 | 25-05-2010 10:05 AM |
| | Bài tập - Thực hành ASP/ASP.NET | thucnq | 0 | 641 | 25-05-2010 09:28 AM |
| | Bài tập - Thực hành ASP/ASP.NET | thucnq | 0 | 461 | 25-05-2010 09:20 AM |
| | Cấu trúc dữ liệu và giải thuật | thucnq | 0 | 557 | 25-05-2010 08:45 AM |
| | #2 (permalink) | |
| Status: Thành viên Tham gia ngày: Feb 2010 Tuổi: 25 Bài gởi: 1
Thanks: 0
Thanked 1 Time in 1 Post
| đọc qua tí code thui là biết thiếu cái j rồi. hix đoạn mã này chỉ là xây dựng menu chương trình thôi. còn các function thì chẳng thấy đâu sao chạy đây bác ![]()
__________________ Chào mừng bạn tham gia Cộng Đồng Lập Trình Việt Cộng Đồng Lập Trình Việt phi lợi nhuận, hoạt động với tinh thần chia sẻ hiểu biết của tất cả các thành viên. Nơi chúng ta (các lập trình viên) có thể trao đổi, học tập và chia sẻ kiến thức lập trình, IT... | |
| | |
| Những "Lập Trình Viên" đã cảm ơn phppro vì bài viết hay: | Administrator (08-02-2010) |
![]() |
| Bookmarks |
| Tag |
| các, kiếm, mã, mô, mảng, nguồn, phỏng, sắp, tìm, thuật, toán, trên, và, xếp |
| Ðang đọc: 1 (0 thành viên và 1 khách) | |
| Ðiều Chỉnh | |
| |