Java第三章40页例3-1(对整数排序)
来源:互联网 发布:mssql server 2008 r2 编辑:程序博客网 时间:2024/06/06 10:00
Number 类
/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author Administrator */public class Number { public void sort(int a,int b,int c){ int count=0; int temp=0; if(a>b){ temp=a; a=b; b=temp; count=count+1; System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c); } if(a>c){ temp=a; a=c; c=temp; count=count+1; System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c); } if(b>c){ temp=b; b=c; c=temp; count=count+1; System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c); } if(count==0){ System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c); } }}
Test 类
/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author Administrator */public class Test { public static void main(String[] args){ // int a,b,c; // Input ip=new Input(); // a=ip.scan(); Number num=new Number(); num.sort(88, 77,22); } }
0 0
- Java第三章40页例3-1(对整数排序)
- 第3章:对三个整数排序
- java编程之对10个整数进行排序(从命令窗输入数据)
- java编程之对10个整数进行排序(从对话窗体输入数据)
- 【Java学习】java中对两个整数在不用第三方变量互换?
- 对0到n^3-1区间内的n个整数进行排序
- 对给定的3个整数从小到大排序
- 随机生成整数 然后对其排序(冒泡法)
- lintcode整数排序|冒泡排序算法(Java)
- lintcode整数排序|选择排序算法(Java)
- lintcode整数排序|插入排序算法(Java)
- lintcode 整数排序 | 希尔排序算法(Java)
- lintcode 整数排序 II | 归并排序(Java)
- lintcode 整数排序 II | 快速排序(Java)
- 【LintCode-463】整数排序(Java实现-冒泡排序优化)
- Java中对整数格式化
- 用选择法对十个整数排序
- 指针对整数数组的排序
- 4种方法让SpringMVC接收多个对象
- 函数模板
- ipython notebook
- 使用Microsoft word插入代码段
- php安装gd库扩展
- Java第三章40页例3-1(对整数排序)
- linux 设置虚拟IP
- JavaSE 异常
- UI进阶03
- CentOS7 安装svn
- select、poll、epoll之间的区别总结
- Java 实现 堆排序 快速排序 以及 TopK问题(一)
- MySQL批量导出以某数字或字母开头的表
- Websocket TCP/IP Http 协议的关系