RSS
热门关键字:  jsp信息管理  jsp  学生管理  孙鑫  西門掃雪
当前位置 :| 首页>新手入门>

数组实现杨辉三角

来源:JAVA世界 作者:www.javaif.com 时间:2008-06-01 Tag: 点击:

//写一个终端输入类以便键盘输入需要数值
import java.io.*;
public class ConsoleReader
{
    private String temp;
    BufferedReader reader;
    public ConsoleReader()
    {
        reader = new BufferedReader(new InputStreamReader(System.in));
    }
    public int getInt()
    {
        try
        {
            temp = reader.readLine();
        }
        catch (IOException ex)
        {
            ex.printStackTrace();
        }

        return Integer.parseInt(temp);
    }
}

//数组实现杨辉三角
import com.mfg.console.ConsoleReader;
public class YanHui
{
    int[][] a;
    public YanHui()
    {
        ConsoleReader console=new ConsoleReader();
        System.out.print("请输入要求的杨辉三角的级数:");
        int n=console.getInt();
        a=new int[n][];
        for(int i=0;i

//写一个终端输入类以便键盘输入需要数值 import java.io.*; public class ConsoleReader { private String temp; BufferedReader reader; public ConsoleReader() { reader = new BufferedReader(new InputStreamReader(System.in)); } public int getInt() { try { temp = reader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } return Integer.parseInt(temp); } } //数组实现杨辉三角 import com.mfg.console.ConsoleReader; public class YanHui { int[][] a; public YanHui() { ConsoleReader console=new ConsoleReader(); System.out.print("请输入要求的杨辉三角的级数:"); int n=console.getInt(); a=new int[n][]; for(int i=0;i
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
热门焦点
精彩推荐