.
2¡¢
package t1; import java.io.*; public class T1 {
public static void main(String[] args) throws IOException{
FileReader fin=new FileReader(\); BufferedReader bin=new BufferedReader(fin); String str;
while((str=bin.readLine())!=null) System.out.println(str); bin.close(); }
}
ÈÕÆÚ£º 2018Äê5Ô µØµã£ºÃ÷ÏòÐ£Çø¹«¹²»ú·¿6
Word ×ÊÁÏ
.
£¨4£©ÊµÑéÌâÄ¿£¬ÊµÑéÔÀíºÍÄÚÈÝ Ò»£®ÊµÑéÄ¿µÄ£ºÎļþÓëÊý¾ÝÁ÷¡£
¶þ£®ÊµÑéÔÀí£ºÊ¹Óñê×¼ÊäÈëÊä³öÁ÷£¬Ê¹ÓÃ×Ö·ûÊäÈëÊä³öÁ÷£¬Ê¹ÓÃËæ»úÎļþÀ࣬ÎļþµÄ
¶Áд²Ù×÷¡£
Èý£®ÊµÑéÄÚÈݼ°ÒªÇó£º
1.ʹÓñê×¼ÊäÈëÊä³öÁ÷ 2.ʹÓÃ×Ö·ûÊäÈëÊä³öÁ÷ 3.ʹÓÃËæ»úÎļþÀà 4.ÎļþµÄ¶Áд²Ù×÷
ËÄ£®ÌâÄ¿£º
1. ±àдһ¸ö³ÌÐò£¬ÔÚ¿ØÖÆÌ¨Öд°¿ÚÖÐÌáʾÊäÈëÁ½¸öÕûÊý£¬È»ºó½ÓÊÕÕâÁ½¸öÕûÊý£¬²¢Êä³öËüÃǵĺͣ¬ÏÂÃæÊÇÔËÐйý³ÌµÄʾÀý£º ÇëÊäÈëµÚÒ»¸öÕûÊý£º45 ÇëÊäÈëµÚ¶þ¸öÕûÊý£º23 ¼ÆËã½á¹û£º45+23=68
2. ±àдһ¸ö³ÌÐò£¬ÒªÇóÊäÈë5¸öѧÉúµÄ³É¼¨£¨´Ó0µ½100µÄÕûÊý£©£¬²¢½«Õâ5¸öÊý±£´æµ½Îļþ¡°data.txt¡±ÖС£È»ºóÔÙ±àдһ¸ö³ÌÐò£¬´ÓÎļþµÄ¡°data.txt¡±ÖжÁÈ¡Õâ5¸öѧÉúµÄ³É¼¨£¬¼ÆËã²¢Êä³öËüÃÇµÄÆ½¾ùÊý£¬È»ºóÔÙ°´´ÓСµ½´óµÄ˳ÐòÊä³öÕâ5¸öѧÉúµÄ³É¼¨¡£
3. ±àдһ¸ö³ÌÐò¡£ÐÞ¸ÄÔÚÉÏÒ»ÌâÉú³ÉµÄÎļþ¡°data.txt¡±ÖеÄÎļþÄÚÈÝ£¬Ê¹µÃµÚÈý¸öѧÉúµÄ³É¼¨±ä³ÉΪÕâ5¸öѧÉúµÄƽ¾ù³É¼¨£¬²¢ÔÚ¿ØÖÆÌ¨´°¿ÚÖÐÊä³öÔÚÐÞ¸ÄÒÔºóµÄÎļþÄÚÈÝ¡£
4. ÊäÈëÒ»¸ö²»¶àÓÚ5λµÄÕýÕûÊý£¬ÒªÇó£ºÒ»£¬ÇóËüÊǼ¸Î»Êý£¬¶þ£¬ÄæÐò´òÓ¡³ö¸÷λÊý×Ö¡£
ÒªÇó£ºÇëͬѧÃǰѵ÷ÊԺõijÌÐò¼°ÔËÐнá¹û¡¢´æÔÚµÄÎÊÌâдÔÚÏÂÃæ£¨²»¹»¿ÉÒÔ¸½Ò³£©¡£ 1¡¢
package TEST1; import java.util.Scanner;
public class tese1 {public static void main(String[] args) {
Scanner s1=new Scanner(System.in); int a1=s1.nextInt();
System.out.print(\ÇëÊäÈëµÚ¶þ¸öÕûÊý£º\); Scanner s2=new Scanner(System.in); int a2=s2.nextInt();
System.out.print(\ÇëÊäÈëµÚÒ»¸öÕûÊý£º\);
Word ×ÊÁÏ
.
}
System.out.print(\¼ÆËã½á¹û£º\+a1+\+a2+\+(a1+a2)); }
2¡¢
package TEST2; import java.io.*; import java.util.*; public class test2 {
private File file=new File(\); private FileOutputStream fos; private PrintWriter pw; public void writeScore() { }
public int[] readScore() {
int[]sort=null; try { try { }
fos=new FileOutputStream(file,false); pw=new PrintWriter(fos);
Scanner input=new Scanner(System.in); for(int i=0;i<5;i++) { }
pw.flush(); fos.flush(); pw.close(); fos.close(); e.printStackTrace(); e.printStackTrace();
String score=input.nextLine(); pw.println(score);
} catch (FileNotFoundException e) { } catch (IOException e) {
Word ×ÊÁÏ
.
}
}
}
int pos=0;
BufferedReader br=new BufferedReader(new InputStreamReader(new String line=null; sort=new int[5];
while((line=br.readLine())!=null) { } br.close();
e.printStackTrace(); e.printStackTrace(); e.printStackTrace();
sort[pos]=Integer.parseInt(line); pos++;
FileInputStream(file)));
} catch (FileNotFoundException e) { } catch (NumberFormatException e) { } catch (IOException e) {
return sort;
public static void main(String[]args) { }
test2 d=new test2(); int sum=0;
System.out.println(\ÇëÊäÈë³É¼¨£º\); d.writeScore();
int[] sort=d.readScore(); Arrays.sort(sort);
System.out.println(\ÅÅÐòÒÔºóµÄ³É¼¨£º\); for(int i:sort) { }
System.out.println();
System.out.println(\ƽ¾ùÖµ£º\+sum/sort.length);
sum+=i;
System.out.print(i+\);
Word ×ÊÁÏ