소스 파일명: testWhileCPP.cpp

  1. /*
  2.  * Filename: testWhileCPP.cpp
  3.  *
  4.  * Purpose:  Example using the while loop syntax
  5.  *               while ....
  6.  *
  7.  * Compile:  cl -EHsc testWhileCPP.cpp
  8.  *
  9.  * Execute:  testWhileCPP -200 300
  10. */
  11. #include <iostream>
  12. #include <cmath>
  13. using namespace std;
  14. // 사용법 표시
  15. void printUsage() {
  16.     cout << "Using: testWhileCPP [integer1] [integer2]" << endl;
  17.     cout << "This finds the greatest common divisor of the given two integers." << endl;
  18. }
  19. int main(int argc, char *argv[]) {
  20.     long val1, val2;
  21.     long a, b, q, r, gcd;
  22.     if (argc != 3) {
  23.         printUsage();
  24.         exit(1);
  25.     }
  26.     // 명령행 인자의 두 스트링을 가져와서
  27.     // 긴정수(long) 타입으로 변환하여
  28.     // 변수 val1과 val2에 저장한다.
  29.     val1 = atoi(argv[1]);
  30.     val2 = atoi(argv[2]);
  31.     // a는 |val1|, |val2| 중 큰 값
  32.     a = abs(val1);
  33.     b = abs(val2);
  34.     if (a < b) {
  35.         a = abs(val2);
  36.         b = abs(val1);
  37.     }
  38.     if (b == 0L) {
  39.         cout << "GCD(" << val1 << ", " << val2 << ") = " << a << endl;
  40.         exit(0);
  41.     }
  42.     // -------------------------------------------
  43.     // Euclidean 알고리즘의 시작
  44.     //
  45.     // a를 b로 나누어 몫은 q에, 나머지는 r에 저장
  46.     q = a / b;
  47.     r = a % b;
  48.     // Euclidean 알고리즘의 반복 (나머지 r이 0이 될 때 까지)
  49.     while (r != 0L) {
  50.         a = b;
  51.         b = r;
  52.         q = a / b;
  53.         r = a % b;
  54.     }
  55.     // 나머지가 0이면 그 때 나눈 수(제수) b가 최대공약수(GCD)이다.
  56.     gcd = b;
  57.     // 최대공약수(GCD)를 출력한다.
  58.     cout << "GCD(" << val1 << ", " << val2 << ") = " << gcd << endl;
  59.     return 0;
  60. }



컴파일:

Command> cl -EHsc testWhileCPP.cpp


실행:

Command> testWhileCPP
Using: testWhileCPP [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

Command> testWhileCPP 200 -300
GCD(200, -300) = 100

Command> testWhileCPP 0 -300
GCD(0, -300) = 300

Command> testWhileCPP 20 -125
GCD(20, -125) = 5

Command> testWhileCPP 121 66
GCD(121, 66) = 11

Command> testWhileCPP -111 -37
GCD(-111, -37) = 37




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,

소스 파일명: testWhile.c

  1. /*
  2.  * Filename: testWhile.c
  3.  *
  4.  * Purpose:  Example using the while loop syntax
  5.  *               while ....
  6.  *
  7.  * Compile:  cl testWhile.c
  8.  *
  9.  * Execute:  testWhile -200 300
  10. */
  11. #include <stdio.h>
  12. #include <math.h>
  13. // 사용법 표시
  14. void printUsage() {
  15.     printf("Using: testWhile [integer1] [integer2]\n");
  16.     printf("This finds the greatest common divisor of the given two integers.\n");
  17. }
  18. int main(int argc, char *argv[]) {
  19.     long val1, val2;
  20.     long a, b, q, r, gcd;
  21.     if (argc != 3) {
  22.         printUsage();
  23.         exit(1);
  24.     }
  25.     // 명령행 인자의 두 스트링을 가져와서
  26.     // 긴정수(long) 타입으로 변환하여
  27.     // 변수 val1과 val2에 저장한다.
  28.     val1 = atoi(argv[1]);
  29.     val2 = atoi(argv[2]);
  30.     // a는 |val1|, |val2| 중 큰 값
  31.     a = abs(val1);
  32.     b = abs(val2);
  33.     if (a < b) {
  34.         a = abs(val2);
  35.         b = abs(val1);
  36.     }
  37.     if (b == 0L) {
  38.         printf("GCD(%ld, %ld) = %ld\n", val1, val2, a);
  39.         exit(0);
  40.     }
  41.     // -------------------------------------------
  42.     // Euclidean 알고리즘의 시작
  43.     //
  44.     // a를 b로 나누어 몫은 q에, 나머지는 r에 저장
  45.     q = a / b;
  46.     r = a % b;
  47.     // Euclidean 알고리즘의 반복 (나머지 r이 0이 될 때 까지)
  48.     while (r != 0L) {
  49.         a = b;
  50.          b = r;
  51.         q = a / b;
  52.         r = a % b;
  53.     }
  54.     // 나머지가 0이면 그 때 나눈 수(제수) b가 최대공약수(GCD)이다.
  55.     gcd = b;
  56.     // 최대공약수(GCD)를 출력한다.
  57.     printf("GCD(%ld, %ld) = %ld\n", val1, val2, gcd);
  58.     return 0;
  59. }



컴파일:

Command> cl testWhile.c


실행:

Command> testWhile
Using: testWhile [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

Command> testWhile 200 -300
GCD(200, -300) = 100

Command> testWhile 0 -300
GCD(0, -300) = 300

Command> testWhile 20 -125
GCD(20, -125) = 5

Command> testWhile 121 66
GCD(121, 66) = 11

Command> testWhile -111 -37
GCD(-111, -37) = 37

Posted by Scripter
,

소스 파일명: testWhile.lua

  1. --[[
  2.   Filename: testWhile.lua
  3.   Purpose:  Example using the while loop syntax
  4.                 while ....
  5.   Execute: lua testWhile.lua -200 300
  6. --]]
  7. -- 사용법 표시
  8. function printUsage()
  9.     print "Using: lua testWhile.lua [integer1] [integer2]"
  10.     print "This finds the greatest common divisor of the given two integers."
  11. end
  12. if #arg ~= 2 then
  13.     printUsage()
  14.     os.exit(1)
  15. end
  16. -- 명령행 인자의 두 스트링을 가져와서
  17. -- 정수 타입으로 변환하여
  18. -- 변수 val1과 val2에 저장한다.
  19. val1 = tonumber(arg[1])
  20. val2 = tonumber(arg[2])
  21. -- a는 |val1|, |val2| 중 큰 값
  22. a = math.abs(val1)
  23. b = math.abs(val2)
  24. if a < b then
  25.     a = math.abs(val2)
  26.     b = math.abs(val1)
  27. end
  28. if b == 0 then
  29.     print( "GCD(" .. val1 .. ", " .. val2 .. ") = " .. a )
  30.     os.exit(0)
  31. end
  32. -- Euclidean 알고리즘의 시작
  33. --
  34. -- a를 b로 나누어 몫은 q에, 나머지는 r에 저장
  35. q = a / b
  36. r = a % b
  37. -- Euclidean 알고리즘의 반복 (나머지 r이 0이 될 때 까지)
  38. while r ~= 0 do
  39.     a = b
  40.     b = r
  41.     q = a / b
  42.     r = a % b
  43. end
  44. -- 나머지가 0이면 그 때 나눈 수(제수) b가 최대공약수(GCD)이다.
  45. gcd = b
  46. -- 최대공약수(GCD)를 출력한다.
  47. print( "GCD(" .. val1 .. ", " .. val2 .. ") = " .. gcd )



실행:

Command> lua testWhile.lua
Using: lua testWhile.lua [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

Command> lua testWhile.lua -200 0
GCD(-200, 0) = 200

Command> lua testWhile.lua -200 300
GCD(-200, 300) = 100

Command> lua testWhile.lua 21 81
GCD(21, 81) = 3

Command> lua testWhile.lua 23 25
GCD(23, 25) = 1




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,

소스 파일명: testWhile.py

  1. # coding=euc-kr
  2. #  Filename: testWhile.py
  3. #
  4. #  Purpose:  Example using the while loop syntax
  5. #                while ....
  6. #
  7. # Execute: python testWhile.py -200 300
  8. #
  9. import sys
  10. # 사용법 표시
  11. def printUsage():
  12.     print "Using: python testWhile.py [integer1] [integer2]"
  13.     print "This finds the greatest common divisor of the given two integers."
  14. if len(sys.argv) != 3:
  15.     printUsage()
  16.     sys.exit(1)
  17. # --------------------------------------
  18. # 명령행 인자의 두 스트링을 가져와서
  19. # 정수 타입으로 변환하여
  20. # 변수 val1과 val2에 저장한다.
  21. val1 = long(sys.argv[1])
  22. val2 = long(sys.argv[2])
  23. # a는 |val1|, |val2| 중 큰 값
  24. a = abs(val1)
  25. b = abs(val2)
  26. if a < b:
  27.     a = abs(val2)
  28.     b = abs(val1)
  29. if b == 0:
  30.     print "GCD(%d, %d) = %d" % (val1, val2, a)
  31.     sys.exit(0)
  32. # --------------------------------------
  33. # Euclidean 알고리즘의 시작
  34. #
  35. # a를 b로 나누어 몫은 q에, 나머지는 r에 저장
  36. q = a / b
  37. r = a % b
  38. # --------------------------------------
  39. # Euclidean 알고리즘의 반복 (나머지 r이 0이 될 때 까지)
  40. while r != 0:
  41.     a = b
  42.     b = r
  43.     q = a / b
  44.     r = a % b
  45. # 나머지가 0이면 그 때 나눈 수(제수) b가 최대공약수(GCD)이다.
  46. gcd = b
  47. # 최대공약수(GCD)를 출력한다.
  48. print "GCD(%d, %d) = %d" % (val1, val2, gcd)


실행:

Command> python testWhile.py
Using: python testWhile.py [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

Command> python testWhile.py -200 300
GCD(-200, 300) = 100

Command> python testWhile.py -200 0
GCD(-200, 0) = 200

Command> python testWhile.py 125 100
GCD(125, 100) = 25

Command> python testWhile.py 23 25
GCD(23, 25) = 1


위의 소스 코드는 ipy 명령에 의하여 IronPython에서도 수정 없이 그대로 실행된다.




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,

소스 파일명: testWhile.rb

  1. #
  2. #  Filename: testWhile.rb
  3. #
  4. #  Purpose:  Example using the while loop syntax
  5. #                while ....
  6. #
  7. # Execute: ruby testWhile.rb -200 300
  8. #
  9. # 사용법 표시
  10. def printUsage()
  11.     print "Using: ruby testWhile.rb [integer1] [integer2]\n"
  12.     print "This finds the greatest common divisor of the given two integers.\n"
  13. end
  14. if (ARGV.length != 2)
  15.     printUsage()
  16.     exit(1)
  17. end
  18. # --------------------------------------
  19. # 명령행 인자의 두 스트링을 가져와서
  20. # 정수 타입으로 변환하여
  21. # 변수 val1과 val2에 저장한다.
  22. val1 = ARGV[0].to_i
  23. val2 = ARGV[1].to_i
  24. # a는 |val1|, |val2| 중 큰 값
  25. a = val1.abs
  26. b = val2.abs
  27. if (a < b) then
  28.     a = val2.abs
  29.     b = val1.abs
  30. end
  31. if (b == 0)
  32.     print "GCD(#{val1}, #{val2}) = #{a}\n"
  33.     exit(0)
  34. end
  35. # --------------------------------------
  36. # Euclidean 알고리즘의 시작
  37. #
  38. # a를 b로 나누어 몫은 q에, 나머지는 r에 저장
  39. q = a / b
  40. r = a % b
  41. # --------------------------------------
  42. # Euclidean 알고리즘의 반복 (나머지 r이 0이 될 때 까지)
  43. while (r != 0)
  44.     a = b
  45.     b = r
  46.     q = a / b
  47.     r = a % b
  48. end
  49. # 나머지가 0이면 그 때 나눈 수(제수) b가 최대공약수(GCD)이다.
  50. gcd = b
  51. # 최대공약수(GCD)를 출력한다
  52. print "GCD(#{val1}, #{val2}) = #{gcd}\n"




실행:

Command> ruby testWhile.rb
Using: ruby testWhile.rb [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

Command> ruby testWhile.rb 23 25
GCD(23, 25) = 1

Command> ruby testWhile.rb 230 25
GCD(230, 25) = 5

Command> ruby testWhile.rb 230 125
GCD(230, 125) = 5

Command> ruby testWhile.rb -200 300
GCD(-200, 300) = 100




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,

간단한 Groovy 스크립트:

def name='World'; println "Hello $name!"

다소 복잡한 Groovy 스크립트:

class Greet {
  def name
  Greet(who) { name = who[0].toUpperCase() + who[1..-1] }
  def salute() { println "Hello $name!" }
}

g = new Greet('world')  // 객체 생성
g.salute()              // "Hello World!"를 출력




Apache의 commons.lang 라이브러리를 이용한 스크립트
(한 개의 소스 파일로 저장한다.):

class Greet {
  def name
  Greet() {  }
  Greet(who) { name = who[0].toUpperCase() + who[1..-1] }
  def salute() { println "Hello, $name!" }
}
g = new Greet('world')  // 객체 생성
g.salute()              // "Hello, World!"를 출력

import static org.apache.commons.lang.WordUtils.*

















명령행 스크립트로 실행한 경우:
groovy -e "println 'Hello ' + args[0] + '!'" World
Posted by Scripter
,

아래의 소스 코드는 Groovy로도 실행되는 Java 용 소스파일 TestWhileLoop.java를 Groovy 용으로 Groovy 언어 답게 고친 것이다.

소스 파일명: testWhile.groovy

  1. /*
  2.  *  Filename: testWhile.groovy
  3.  *
  4.  *  Purpose:  Example using the while loop syntax
  5.  *                while ....
  6.  *
  7.  *  Execute: groovy testWhile.groovy -200 300
  8.  *
  9.  */
  10. // java.lang.Math 클래스를 명시적으로 import하는 구문이 없어도
  11. // Groovy는 이 클래스를 자동으로 import한다.
  12. // 사용법 표시
  13. def printUsage() {
  14.     println 'Using: groovy testWhile.groovy [integer1] [integer2]'
  15.     println 'This finds the greatest common divisor of the given two integers.'
  16. }
  17. if (args.length != 2) {
  18.     printUsage()
  19.     System.exit(1)
  20. }
  21. def val1 = args[0].toLong()
  22. def val2 = args[1].toLong()
  23. def a, b, q, r, gcd
  24. ////////////////////////////////////////////////
  25. // 명령행 인자의 두 스트링을 가져와서
  26. // 긴정수(long) 타입으로 변환하여
  27. // 변수 val1과 val2에 저장한다.
  28. a = val1.abs()
  29. b = val2.abs()
  30. // a는 |val1|, |val2| 중 큰 값
  31. if (a < b) {
  32.     a = val2.abs()
  33.     b = val1.abs()
  34. }
  35. if (b == 0L) {
  36.     println "GCD($val1, $val2) = $a"
  37.     System.exit(0)
  38. }
  39. ////////////////////////////////////////
  40. // Euclidean 알고리즘의 시작
  41. //
  42. // a를 b로 나누어 몫은 q에, 나머지는 r에 저장
  43. q = a / b
  44. r = a % b
  45. ////////////////////////////////////////
  46. // Euclidean 알고리즘의 반복 (나머지 r이 0이 될 때 까지)
  47. while (r != 0L) {
  48.     a = b
  49.     b = r
  50.     q = a / b
  51.     r = a % b
  52. }
  53. // 나머지가 0이면 그 때 나눈 수(제수) b가 최대공약수(GCD)이다.
  54. gcd = b
  55. // 최대공약수(GCD)를 출력한다.
  56. println "GCD($val1, $val2) = $gcd"


실행> groovy testWhile.groovy
Using: groovy testWhile.groovy [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

실행> groovy testWhile.groovy -50, 200
GCD(-50, 200) = 50

실행> groovy testWhile.groovy 50, -30
GCD(50, -30) = 10

실행> groovy testWhile.groovy 0. 30
GCD(0, 30) = 30




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,

소스 파일명: TestWhileLoop.java

  1. /*
  2.  *  Filename: TestWhileLoop.java
  3.  *
  4.  *  Purpose:  Example using the while loop syntax
  5.  *                while ....
  6.  *
  7.  *  Compile: javac -d . TestWhileLoop.java
  8.  *  Execute: java TestWhileLoop -200 300
  9.  *
  10.  */
  11. import java.lang.Math;
  12. public class TestWhileLoop {
  13.     // 사용법 표시
  14.     public static void printUsage() {
  15.          System.out.println("Using: java TestWhileLoop [integer1] [integer2]");
  16.          System.out.println("This finds the greatest common divisor of the given two integers.");
  17.     }
  18.     // Java 애플리케이션의 실행 시작 시점 main 메소드
  19.     // (C 언어의 main 함수에 해당)
  20.     public static void main(String[] args) {
  21.         if (args.length != 2) {
  22.             printUsage();
  23.             System.exit(1);
  24.         }
  25.         ////////////////////////////////////////////////
  26.         // 명령행 인자의 두 스트링을 가져와서
  27.         // 긴정수(long) 타입으로 변환하여
  28.         // 변수 val1과 val2에 저장한다.
  29.         long val1 = Long.parseLong(args[0]);
  30.         long val2 = Long.parseLong(args[1]);
  31.         long a, b, q, r, gcd;    // r은 나머지, q는 몫
  32.         // a는 |val1|, |val2| 중 큰 값
  33.         a = Math.abs(val1);
  34.         b = Math.abs(val2);
  35.         if (a < b) {
  36.             a = Math.abs(val2);
  37.             b = Math.abs(val1);
  38.         }
  39.         if (b == 0L) {
  40.             System.out.println("GCD(" + val1 + ", " + val2 + ") = " + a);
  41.             System.exit(0);
  42.         }
  43.         ////////////////////////////////////////
  44.         // Euclidean 알고리즘의 시작
  45.         //
  46.         // a를 b로 나누어 몫은 q에, 나머지는 r에 저장
  47.         q = a / b;
  48.         r = a % b;
  49.         ////////////////////////////////////////
  50.         // Euclidean 알고리즘의 반복 (나머지 r이 0이 될 때 까지)
  51.         while (r != 0L) {
  52.             a = b;
  53.             b = r;
  54.             q = a / b;
  55.             r = a % b;
  56.         }
  57.         // 나머지가 0이면 그 때 나눈 수(제수) b가 최대공약수(GCD)이다.
  58.         gcd = b;
  59.         // 최대공약수(GCD)를 출력한다.
  60.         System.out.println("GCD(" + val1 + ", " + val2 + ") = " + gcd);
  61.     }
  62. }

컴파일> javac -d . TestWhileLoop.java

실행> java TestWhileLoop
Using: java TestWhileLoop [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

실행> java TestWhileLoop 200 300
GCD(200, 300) = 100

실행> java TestWhileLoop 50, -20
GCD(50, -20) = 10

실행> java TestWhileLoop -30, 0
GCD(-30, 0) = 30



Groovy를 사용하면 위의 소스를 (컴파일 과정 없이) 그대로 실행시킬 수 있다. 그대신 파일 확장자명을 groovy로 하여 저장하여야 한다. 아래는 파일명을 TestWhileLoop.groovy로 저장하여 실행시칸 경우이다.


실행> groovy TestWhileLoop.groovy
Using: java TestWhileLoop [integer1] [integer2]
This finds the greatest common divisor of the given two integers.

실행> groovy TestWhileLoop.groovy -200 500
GCD(-200, 500) = 100

실행> groovy TestWhileLoop.groovy 108, 180
GCD(108, 180) = 36

실행> groovy TestArguments.groovy -30, 0
GCD(-30, 0) = 30




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,

소스 파일명: testIf.lua

  1. --[[
  2.    Filename: testIf.lua
  3.    Purpose:  Example using the conditional control structure syntax
  4.                  if .... else ...
  5.    Execute: lua testIf.lua [number]
  6. --]]
  7. -- 사용법을 보여주는 함수
  8. function printUsing()
  9.    print("Using: ruby testIf.rb [number]")
  10.    print("This determines whether the number is positive or not.")
  11. end
  12. -- 명령행 인자의 개수가 1이 아니면 사용법을 보여준다.
  13. if #arg ~= 1 then
  14.     printUsing()
  15.     os.exit(1)
  16. end
  17. -- 명령행 인자의 스트링을 가져와서
  18. -- 배정밀도 부동소수점수로 변환하여
  19. -- 변수 val에 저장한다.
  20. val = tonumber(arg[1])
  21. -- 변수 val에 저장된 값이 양수인지 음수인지 0인지를
  22. -- 판단하는 if...else... 조건문
  23. if (val > 0.0) then
  24.     print(val .. " is a positive number.")
  25. elseif (val < 0.0) then
  26.     print(val .. " is a negative number.")
  27. else
  28.     print(val .. " is zero.")
  29. end


실행> lua testIf.lua
Using: lua testIf.lua [number]
This determines whether the number is positive or not.

실행> lua testIf.lua 1.21
1.21 is a positive number.

실행> lua testIf.lua -1.21
-1.21 is a negative number.

실행> lua testIf.lua 0
0 is zero.




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,

소스 파일명: testIfCPP.cpp

  1. #include <iostream>
  2. #include <cmath>        // atof() 함수 사용을 위해
  3. using namespace std;    // cout 사용을 위해
  4. // 사용법 표시 함수
  5. void printUsing() {
  6.     cout << "Using: testIfCPP [number]\n";
  7.     cout << "This determines whether the number is positive or not.\n";
  8. }
  9. // main 함수
  10. int main(int argc, char *argv[]) {
  11.     float val;
  12.     if (argc != 2) {
  13.         printUsing();
  14.         exit(1);
  15.         return 1;
  16.     }
  17.     // 명령행 인자의 스트링을 가져와서
  18.     // 배정밀도 부동소수점수로 변환하여
  19.     // 변수 val에 저장한다.
  20.     val = atof(argv[1]);
  21.     // 변수 val에 저장된 값이 양수인지 음수인지 0인지를
  22.     // 판단하는 if...else... 조건문
  23.     if (val > 0.0)
  24.         cout << val << " is a positive number.\n";
  25.     else if (val < 0.0)
  26.         cout << val << " is a negative number.\n";
  27.     else
  28.         cout << val << " is zero.\n";
  29.     return 0;
  30. }

컴파일> cl /GX testIfCPP.cpp

실행> testIfCPP
Using: testIfCPP [number]
This determines whether the number is positive or not.

실행> testIfCPP 1.234
1.234 is a positive number.

실행> testIfCPP 1.234
-1.234 is a negative number.

실행> testIfCPP 0
0 is zero.



※ Ch 5.5를 사용하여 컴피일 과정 없이 소스를 실행시키려면 인클루드문

        #incldue <cmath>



        #incldue <math.h>

로 고치면 된다. 그대신 부동소수점수의 출력이 다소 다르다.



실행> ch testIfCPP.cpp
Using: testIfCPP [number]
This determines whether the number is positive or not.

실행> ch testCPP.cpp 2.7
2.7000 is a positive number.

실행> ch testCPP.cpp -2.7
-2.7000 is a negative number.

실행> ch testCPP.cpp 0
0 is zero.




Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

Posted by Scripter
,