Using sorting to pass function parameters

Source: Internet
Author: User
/* 02. * copyright (c) 2012, School of Computer Science, Yantai University 03. * All Rights Reserved. 04. * file name: test. CPP 05. * Author: Liu Mingliang 06. * completion date: March 13, December 19, 2012. * version: V1.0 09. * input Description: None. 10. * Problem description: sort by reference 11. *ProgramOutput: 12. * Problem Analysis: 13 .*AlgorithmDESIGN: omitted 14. */# include <iostream> using namespace STD; void paixu (int * X, int * y, int * z); int main (void) {int A, B, C; cin> A> B> C; paixu (& A, & B, & C); cout <"from large to small: "<A <" "<B <" "<C <Endl; return 0;} void Exchange (int * X, int * Y) {int t; t = * X; * x = * Y; * Y = T;} void paixu (int * X, int * y, int * z) {If (* x <* Y) Exchange (x, y); If (* x <* z) Exchange (x, z); If (* Y <* z) exchange (Y, Z );}

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: info-contact@alibabacloud.com 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.