Saturday, January 18, 2014

Generate random numbers using Math.random()

example used: Lotto 6/49



public class lotto {

 public static void main(String[] args) {
   int num;
  // Generate 6 random numbers that range from 1-49  using Math.random()
   for (int x = 0; x < 6; x++) {
     num = (int) (Math.floor(Math.random() * 49));
 
     System.out.println(num);
   }
 }
}


(note: may produce duplicate numbers)



Examples of COMPILERS

ADA COMPILERS
  • Aonix Object Ada
  • GCC GNAT
  • Irvin Compiler
  • IBM Rational Apex
  • A#
ALGOL COMPILERS
  • ALGOL 60
  • ALGOL 68G(Genie)
  • Persistent S-algol
  • MCP Compiler
BASIC COMPILERS
  • BaCon
  • BlitzMax
  • DoyleSoft Basic
  • FreeBASIC
  • Gambas
  • MMBasic
  • RapidQ
  • Visual Basic
C COMPILERS
  • AMPC
  • Amsterdam Compiler Kit
  • Digital Mars
  • Interactive C
  • Lattice C
  • SAS/C
  • Tiny C Compiler
  • VBCC
SOURCE-TO-SOURCE COMPILERS
  • Parallware
  • Rose Compiler
  • PIPS
C++ COMPILERS
  • Turbo C++ Explorer
  • Clang
  • Microtec
  • Open Watcom
  • PathScale
  • TenDRA
  • XL C/C++
C# COMPILERS
  • Visual C#
  • Visual C# Express
  • Mono
  • Portable .NET
COBOL COMPILERS
  • IBM COBOL
  • NetCOBOL
  • RainCode COBOL
  • Visual COBOL




What is a COMPILER?

A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses. Typically, a programmer writes language statements in a language such as Pascal or C one line at a time using an editor . The file that is created contains what are called the source statements . The programmer then runs the appropriate language compiler, specifying the name of the file that contains the source statements.
When executing (running), the compiler first parses (or analyzes) all of the language statements syntactically one after the other and then, in one or more successive stages or "passes", builds the output code, making sure that statements that refer to other statements are referred to correctly in the final code. Traditionally, the output of the compilation has been called object code or sometimes an object module . (Note that the term "object" here is not related to object-oriented programming .) The object code is machine code that the processor can process or "execute" one instruction at a time.