전체 글 725

손으로 계산하는 긴자리 곱셈표 만들기 with C++

초등학교 때 배우는 두 정수의 곱셈표를 만들어 주는 C++ 소스이다. /* * Filename: makeMultTableCPP.cpp * * Print a multiplication table. * * Compile: cl /EHsc makeMultTableCPP.cpp * Execute: makeMultTableCPP 230 5100 * * Date: 2009/03/07 * Author: pkim (AT) scripts.pe.kr */ #include #include #include using namespace std; void printUsing(); void printMultTable(int x, int y); int main(int argc, char *argv[]) { long x, y; if ..

프로그래밍/C++ 2009.03.07

손으로 계산하는 긴 자리 곱셈표 만들기 with C

초등학교 때 배우는 두 정수의 곱셈표를 만들어 주는 C 소스이다. /* * Filename: makeMultTable.c * * Print a multiplication table. * * Compile: cl makeMultTable.c * Execute: makeMultTable 230 5100 * * Date: 2009/03/06 * Author: pkim (AT) scripts.pe.kr */ #include #include #include void printUsing(); void printMultTable(int x, int y); int main(int argc, char *argv[]) { long x, y; if (argc >= 3) { x = atoi(argv[1]); y = atoi(..

프로그래밍/C 2009.03.07

손으로 계산하는 긴자리 곱셈표 만들기 with Lua

초등학교 때 배우는 두 정수의 곱셈표를 만들어 주는 Lua 소스이다. --[[ Filename: makeMultTable.lua Print a multiplication table. Execute: lua makeMultTable.lua 230 5100 Date: 2009/03/06 --]] function printUsing() print("Using: lua makeMultTable.lua [number1] [number2]") print("Print a multiplication table for the given two integers.") end function printMultTable(x, y) nx = x if nx < 0 then nx = -nx end ny = y if ny < 0 th..

프로그래밍/Lua 2009.03.06

손으로 계산하는 긴자리 곱셈표 만들기 with Ruby

초등학교 때 배우는 두 정수의 곱셈표를 만들어 주는 Ruby 소스이다. # Filename: makeMultTable.rb # # Print a multiplication table. # # Execute: ruby makeMultTable.rb 230 5100 # # Date: 2009/03/06 # # def printUsing() print "Using: ruby makeMultTable.rb [number1] [number2]\n" print "Print a multiplication table for the given two integers.\n" end def printMultTable(x, y) nx = x if nx < 0 nx = -nx end ny = y if ny < 0 ny = -n..

손으로 계산하는 긴자리 곱셈표 만들기 with Python

초등학교 때 배우는 두 정수의 곱셈표를 만들어 주는 Python 소스이다. (이 소스는 Jython이나 IronPython에서도 수정없이 그대로 실행된다.) 이항 연산자 // 는 Python의 정수나눗셈 연산자이다. # Filename: makeMultTable.py # # Print a multiplication table. # # Execute: python makeMultTable.py 230 5100 # # Date: 2009/03/06 # # import sys def printUsing(): print "Using: python makeMultTable.py [number1] [number2]" print "Print a multiplication table for the given two i..

손으로 계산하는 긴자리 곱셈표 만들기 with Groovy

초등학교 때 배우는 두 정수의 곱셈표를 만들어 주는 Groovy 소스이다. /** * Filename: makeMultTable.groovy * * Print a multiplication table. * * Execute: groovy makeMultTable.groovy 230 5100 * * Date: 2009/03/06 * Author: pkim (AT) scripts.pe.kr */ import java.io.*; import java.util.*; def printUsing() { println "Using: groovy makeMultTable.groovy [number1] [number2]" println "Print a multiplication table for the given two..

손으로 계산하는 긴자리 곱셈표 만들기 with Java

초등학교 때 배우는 두 정수의 곱셈표를 만들어 주는 자바 애플리케이션 소스이다. /** * Filename: MakeMultTableApp.java * * Print a multiplication table. * * Compile: javac -d . MakeMultTableApp.java * Execute: java MakeMultTableApp 230 5100 * * Date: 2009/03/06 * Author: pkim (AT) scripts.pe.kr */ import java.io.*; import java.util.*; public class MakeMultTableApp { public static void printUsing() { System.out.println("Using: java..

Hello 예제 for JavaFX

컨솔에 문자 출력하는 JavaFX 구문은 println("문자열(스트링)") 과 print("문자열(스트링)") 이다. println()은 개행 문자 "\n" 없이 개행하지만, print()는 개행 문자 "\n"를 추가해야 개행한다. JavaFX 언어에서는 Groovy 언어와 달리 구문의 끝에 세미콜론(;)을 붙여야 한다. 소스 파일명: hello.fx ------------------------------[소스 시작] println("Hello, world!"); ------------------------------[소스 끝] 컴파일> javafxc hello.fx 실행> javafx hello Hello, world!

간단한 사칙연산 예제 for JavaFX

컴파일하고 실행하는데 필요한 도구: Java 6 SDK JavaFX 1.1 SDK NetBeans 6.5 [참고] JavaFX 홈페이지: www.javafx.com def numOne = 100; def numTwo = 2; var result; add(); subtract(); multiply(); divide(); function add() { result = numOne + numTwo; println("{numOne} + {numTwo} = {result}"); } function subtract() { result = numOne - numTwo; println("{numOne} - {numTwo} = {result}"); } function multiply() { result = numOne ..