HACKIS - Hacking Internet Security
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Tuyệt Kỹ Đong Giai Chân Kinh (tuyệt Kỹ cua trai)
Sắp xếp ma trận tăng dần theo dòng EmptyThu Aug 23, 2012 5:38 am by Admin

» Tuyệt kỹ cua giai
Sắp xếp ma trận tăng dần theo dòng EmptyThu Aug 23, 2012 5:36 am by Admin

» NETCAT.........
Sắp xếp ma trận tăng dần theo dòng EmptyMon Aug 13, 2012 6:35 am by Admin

» Bảo mật CSDL bằng phương pháp mã hóa.
Sắp xếp ma trận tăng dần theo dòng EmptyTue Apr 17, 2012 10:04 pm by Admin

» Hàm mã hóa MD5 bằng JavaScript
Sắp xếp ma trận tăng dần theo dòng EmptyTue Apr 17, 2012 10:03 pm by Admin

» Giá của món quà
Sắp xếp ma trận tăng dần theo dòng EmptyFri Apr 13, 2012 6:01 am by Admin

» Sẽ chỉ yêu ai?
Sắp xếp ma trận tăng dần theo dòng EmptyFri Apr 13, 2012 6:01 am by Admin

» Cách đọc bảng chữ cái!
Sắp xếp ma trận tăng dần theo dòng EmptyThu Apr 12, 2012 10:37 pm by Admin

» Gắn trojan, keylog, virus vào website, forum
Sắp xếp ma trận tăng dần theo dòng EmptyTue Apr 10, 2012 1:14 am by Admin

Affiliates
free forum


Sắp xếp ma trận tăng dần theo dòng

Go down

Sắp xếp ma trận tăng dần theo dòng Empty Sắp xếp ma trận tăng dần theo dòng

Post  Admin Fri Feb 18, 2011 7:07 am

Code:
#include <conio.h>
#include <stdio.h>
#define max 100

void NhapMaTran(int A[max][max], int m, int n)
{
  for(int i = 0; i<m ; i++)
  for(int j = 0; j<n ; j++)
  {
      printf("[%d][%d] =",i,j);
      scanf("%d", &A[i][j]);
  }
}

void XuatMaTran(int A[max][max], int m, int n)
{
  for(int i = 0; i<m ; i++)
  {
      printf("\n");
      for(int j = 0; j<n ; j++)
        printf("%d\t",A[i][j]);
  }

}
/*Sap xep ma tran tang dan theo dong*/
void BubbleSortA(int A[max][max], int m, int n)
{
  for(int k = 0; k<m ; k++)
      for(int i = 0; i<n-1 ; i++)
      for(int j = n-1; j>i ; j--)
      if(A[k][j]<A[k][j-1])
      {
        int temp = A[k][j];
        A[k][j] = A[k][j-1];
        A[k][j-1] = temp;
      }
}
void main()
{
  clrscr();
  int A[max][max], m, n;
  printf("Nhap m, n= ");
  scanf("%d%d",&m,&n);
  NhapMaTran(A,m,n);
  printf("Ma tran A vua nhap\n");
  XuatMaTran(A,m,n);
  printf("\nSap xep tang theo dong\n");
  BubbleSortA(A,m,n);
  XuatMaTran(A,m,n);
  getch();
}
Admin
Admin
Admin

Tổng số bài gửi : 782
Join date : 2009-08-15

https://hackis.forumvi.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum