Sort _ dir_choose (select sort directly)

Source: Internet
Author: User

This is one of the most widely used sorting methods in the past, and today I am still thinking about what is the choice of sorting... I can imagine how hard my foundation is to be played...

# Include <stdio. h> # include <string. h> # include <math. h> # include <iostream> # include <algorithm> # include <string> # define INF 0x3fffffffusing namespace STD; int N; int A [1000]; void dir_choose () {for (INT I = 0; I <n-1; I ++) // This is the legendary direct sorting. it's fun. A simple sorting. {for (Int J = I + 1; j <n; j ++) {if (a [I]> A [J]) {int T = A [I]; A [I] = A [J]; A [J] = T ;}}} int main () {cout <"input the number that you want be sorted: "<Endl; CIN> N; cout <" input the numbers: "<Endl; For (INT I = 0; I <n; I ++) {CIN> A [I];} dir_choose (); For (INT I = 0; I <n; I ++) {cout <A [I] <";}cout <Endl; System (" pause "); Return 0 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.