import java.io.*;
import java.util.*;
 
public class TestClassA {
 
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String filename = "record.txt";
		Random rdn = new Random();
		int num=100;
 
 
 
		try
		{
			FileWriter writer = new FileWriter(filename);
			PrintWriter pw = new PrintWriter(writer);
 
 
			for (int i=0; i<10000; i++)
			{
				num = rdn.nextInt()%101;
				if (num <0) num = -num + 100;
				else num = num + 100;
 
				System.out.printf("%d", num);System.out.println();
				pw.printf("%d", num); pw.println();
			}
 
			writer.close();
		}
		catch (FileNotFoundException fe)
		{
			System.out.printf(fe.getMessage());
			return;
		}
		catch (IOException ie)
		{
			System.out.printf(ie.getMessage());
			return;
		}
	}
 
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , , ,

This entry was posted on 星期三, 五月 29th, 2013 at 11:31:33 and is filed under 101(下)程式設計(二). You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

6 Trackbacks/Pings

  1. alfonso    七月 31 2014 / 12上午:

    cushioning@plays.humiliating” rel=”nofollow”>.…

    ñïñ!…

  2. Troy    八月 23 2014 / 1上午:

    trainman@gases.shoes” rel=”nofollow”>.…

    благодарен!…

  3. Arnold    八月 23 2014 / 8上午:

    priestly@matriculate.cheng” rel=”nofollow”>.…

    tnx for info!!…

  4. isaac    八月 23 2014 / 5下午:

    traditionnel@furnishes.literally” rel=”nofollow”>.…

    спс….

  5. Jimmie    十一月 20 2014 / 5下午:

    begins@lung.concerned” rel=”nofollow”>.…

    thanks for information….

  6. Daniel    十二月 25 2014 / 8上午:

    harford@taksim.uncontrolled” rel=”nofollow”>.…

    tnx for info!…

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment