전체 글 725

명령행 인자 처리 예제 for .NET with C++/CLI

소스 파일명: testArgumentsCli.cpp // Filename: testArgumentsCli.cpp // // Compile: cl /clr testArgumentsCli.cpp // Execute: testArgumentsCli using namespace System; int main(array ^args) { int i; double sum = 0.0; // 초기화 // 명령행 인자(command-line argument) 개수 출력 Console::WriteLine("Count of arguments: {0}", args->Length); for (i = 0; i Length; i++) { // 스트링을 배정밀도 부동소수점수로 변환하여 누적 sum += Convert::..

프로그래밍/C++ 2009.04.29

Hello 예제 for .NET with C++/CLI

C++/CLI는 Visual C++ 2008 부터 등장한 .NET 용 새로운 C++ 프로그램 언어이다. 이는 Visual C++ 2005에 쓰이던 MC++(Mananged C++)의 약점을 보완하며 대체한다. [참고 자료] 1. http://www.codeproject.com/KB/mcpp/cppcliintro01.aspx 2. http://blog.voidnish.com/index.php?p=11 3. http://recoverlee.tistory.com/37?srchid=BR1http%3A%2F%2Frecoverlee.tistory.com%2F37 ------------------------------[소스 시작] // Filename: helloWorldCli.cpp // // Compile: cl..

프로그래밍/C++ 2009.04.29

스트링 리스트에서 스트링 찾기(find) with Visual Basic

[파일명: TestStringFindInList.bas]------------------------------------------------ Imports System Imports System.Collections Imports System.Collections.Generic Namespace MyTestApplication1 Public Class TestStringFindInList ' Java 언어의 main 메소드에 해당하는 Visual Basic의 Main Shared Sub Main(ByVal args As String()) 'Dim words As New List(Of String) From { "하나", "둘", "셋", "넷", "다섯", "여섯" } Dim words As New L..

스트링 배열에서 스트링 찾기(find) with Visual Basic

[파일명: TestStringFindApp.bas]------------------------------------------------ Imports System Imports System.Collections Imports System.Collections.Generic Namespace MyTestApplication1 Public Class TestStringFindApp ' Java 언어의 main 메소드에 해당하는 Visual Basic의 Main Shared Sub Main(ByVal args As String()) Dim words() As String = { "하나", "둘", "셋", "넷", "다섯", "여섯" } Dim where As Integer Console.Write("arr..

스트링 리스트에서 스트링 찾기(find) with C#

[파일명: TestStringFindInList.cs]------------------------------------------------ using System; using System.Collections; using System.Collections.Generic; namespace MyTestApplication1 { class TestStringFindInList { public static void Main(String[] args) { List words = new List(new String[] { "하나", "둘", "셋", "넷", "다섯", "여섯" }); int where; Console.Write("list: "); PrintArray(words); where = Find(wor..

프로그래밍/C# 2009.04.27

스트링 배열에서 스트링 찾기(find) with C#

[파일명: TestStringFindApp.cs]------------------------------------------------ using System; using System.Collections; using System.Collections.Generic; namespace MyTestApplication1 { class TestStringFindApp { public static void Main(String[] args) { String[] words = new String[] { "하나", "둘", "셋", "넷", "다섯", "여섯" }; int where; Console.Write("array: "); PrintArray(words); where = Find(words, "셋"); i..

프로그래밍/C# 2009.04.27

스트링 배열에서 스트링 찾기(find) with Scala

Scala 언어로는 리스트 대신 배열로 처리하였다. [파일명: testStringFindInArray.scala]------------------------------------------------ object TestStringFindInArray { def quickSort(arr: Array[String], start: Int, end: Int) { var i: Int = start var k: Int = end var pivot: String = "" if (end - start >= 1) { pivot = arr(start) while (k > i) { while (arr(i) pivot && k >= start && k >= i) { k -= 1 } if (k > i) { swap(arr, ..

스트링 리스트에서 스트링 찾기(find) with Lua

[파일명: testStringFindInList.lua]------------------------------------------------ function find(arr, s) for i = 1, #arr do if string.find(arr[i], s) ~= nil then return i end end return -1; end function printArray(arr) io.write("[") for i = 1, #arr - 1 do io.write(arr[i] .. ", ") end if #arr > 0 then io.write(arr[#arr]) end io.write("]\n") end words = { "하나", "둘", "셋", "넷", "다섯", "여섯" } io.write("l..

프로그래밍/Lua 2009.04.22

스트링 리스트에서 스트링 찾기(find) with Ruby

[파일명: testStringFindInList.rb]------------------------------------------------ def find(arr, s) for i in 0..arr.size() do if arr[i].index(s) != nil return i end end return -1; end def printArray(arr) print("[") for i in 0..arr.size() - 1 do print(arr[i] + ", ") end if arr.size() > 0 print(arr[arr.size() - 1]) end print("]\n") end words = ["하나", "둘", "셋", "넷", "다섯", "여섯"] print("list: ") printArr..

스트링 리스트에서 스트링 찾기(find) with Python

[파일명: testStringFindInList.py]------------------------------------------------ # coding=ms949 import sys def find(arr, s): for i in range(0, len(arr)): if arr[i].find(s) >= 0: return i return -1; def printArray(arr): sys.stdout.write("[") for i in range(0, len(arr) - 1): sys.stdout.write(arr[i] + ", ") if len(arr) > 0: sys.stdout.write(arr[len(arr) - 1]) print("]") words = ["하나", "둘", "셋", "넷", ..