Topic: 这个程序怎么改???

  Print this page

1.这个程序怎么改??? Copy to clipboard
Posted by: xingchao
Posted on: 2006-10-17 09:47

帮帮忙 这个错在那里了?
为什么在编译时 告送我 “非法的类型开始” “需要〈标识符〉”??

import java.io.*;
class Input{
static String s="";
static void input(){
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try{
s=br.readLine();
}catch(IOException e){}
}
static public int getInt(){
input();
return Integer.parseInt;
}
}
class CMatrix{
int a[][]=new int[4][5];
int row=0,col=0;
int max = a[0][0];
for(int i=0;i<a.length;i++){
for(int j=0;j<a[0].length;j++)

a[i][j]=Input.getInt();
System.out.print(a[i][j]+"\t");
System.out.print("\n");

}
void find(){
for(int i=0;i<a.length;i++){
for(int j=0;j<a[0].length;j++)

if(a[i][j]>max) {
max=a[i][j];
row=i;
col=j;
}
}

System.out.println("the max :"+max);
System.out.println("row="+row);
System.out.println("col="+col);
}

}
public class Matrix{
public static void main(String[] args){
CMatrix c=new CMatirx();
c.find();

}
}

2.Re:这个程序怎么改??? [Re: xingchao] Copy to clipboard
Posted by: joezhou
Posted on: 2006-10-22 12:09

/**
* Created on 2006-10-22 上午11:42:47
*/
package com.redv.cardtools;
import java.io.*;

/**
* @author Shutra
*
*/
public class Input {
  static String s="";
  static void input(){
  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  try{
  s=br.readLine();
  }catch(IOException e){}
  }
  static public int getInt(){
  input();
  return Integer.parseInt;//////////////////////??
  }
  }
  class CMatrix{
  int a[][]=new int[4][5];
  int row=0,col=0;
  int max = a[0][0];
  for(int i=0;i<a.length;i++){ /////////在 class 里面直接写这个??
  for(int j=0;j<a[0].length;j++)

  a[i][j]=Input.getInt();
  System.out.print(a[i][j]+"\t");
  System.out.print("\n");

  }
  void find(){
  for(int i=0;i<a.length;i++){
  for(int j=0;j<a[0].length;j++)

  if(a[i][j]>max) {
  max=a[i][j];
  row=i;
  col=j;
  }
  }

  System.out.println("the max :"+max);
  System.out.println("row="+row);
  System.out.println("col="+col);
  }

  }
  public class Matrix{
  public static void main(String[] args){
  CMatrix c=new CMatirx();
  c.find();

  }
  
}

3.Re:这个程序怎么改??? [Re: xingchao] Copy to clipboard
Posted by: kimjava
Posted on: 2006-11-03 03:05

import java.io.*;
class Input{
static String s="";
static String input(){
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try{
s=br.readLine();

}catch(IOException e){}
return s;
}
static public int getInt(){
s=input();
int m=Integer.parseIntMoon;
return m;
}
}
class CMatrix{
int[][] a=new int[4][5];
int row=0,col=0;
int max = a[0][0];
CMatrix()
{
for(int i=0;i<a.length;i++)
for(int j=0;j<a[0].length;j++)
{a[i][j]=Input.getInt();
System.out.print(a[i][j]+"\t");
System.out.print("\n");
}
}
void find(){
for(int i=0;i<a.length;i++){
for(int j=0;j<a[0].length;j++)

if(a[i][j]>max) {
max=a[i][j];
row=i;
col=j;
}
}

System.out.println("the max :"+max);
System.out.println("row="+row);
System.out.println("col="+col);
}

}
public class Matrix{
public static void main(String[] args){
CMatrix c=new CMatrix();
c.find();

}
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923