Archive for the ‘98(上)C程式設計’ Category

using System;
namespace LottoTicket1
{
    class Program
    {
        static void Main(string[] args)
        {
           /*在以下寫程式*/
 
	       /*寫到這裡*/
        }
        void LottoNumGen(int[] List)
        {
	    /*在以下寫程式*/
 
	    /*寫到這裡*/
        }
    }
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

17
十二月

C程式設計:將C程式改寫成Java程式

   Posted by: admin Tags: , ,

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

 
package ex10.util.asia;
 
import java.util.*;
import java.io.*;
 
public class LottoTicket {
 
 public static void main(String[] args)
 {
 
  /*在以下寫程式*/
 
  /*寫到這裡*/ 
 }
 static void LottoNumGen(int List[])
 {
  /*在以下寫程式*/
 
  /*寫到這裡*/
 }
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

10
十二月

C程式設計12/10:示範樂透號碼產生程式

   Posted by: admin Tags: ,

void LottoNumGen(int List[])
{
    int i, j;
    int number[49], highest, which;
 
    for (i=0; i<49; i++)
    { 
        number[i]=rand();
    }
    for (i=0; i<6; i++)
    {
       highest = 0; which = -1;
       /*每次選最高分*/
       for (j=0; j< 49; j++)
       {
           if (number[j] > highest)
           {
               highest = number[j]; which=j;
           }
       }
       List[i]=which+1; number[which]=0;
    }
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark