This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def logstn(strs, number) | |
while (number >0) | |
logest = strs.inject do |first, second| | |
(first.length > second.length)? first : second | |
end | |
puts logest | |
strs.delete_if {|x| x==logest} | |
number -= 1 | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Ruby | |
puts " ----------------------- Basic moniplation --------------" | |
i=1 | |
k="ss" | |
i=i+1 | |
I=2 | |
I=I+2 | |
puts k | |
puts i | |
puts k+i.to_s #不可直接轉型~這是基本提供轉型與轉字串 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class foo_class | |
{ | |
foo_class() | |
private: | |
int a=0; | |
public: | |
int b=0, | |
void foo_fun1(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def quickSort_bigendian(input_arry) | |
index_i = 0 | |
puts "Before sort" | |
puts input_arry.inspect | |
while (index_i < input_arry.size) | |
index_j = input_arry.size | |
index_j -= 1 | |
while (index_j > index_i) | |
if ( input_arry[index_j] < input_arry[index_j-1] ) | |
temp = input_arry[index_j-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibinacci(fib_number) | |
return fib_number <= 1 ? 1 : fibinacci(fib_number - 1) + fibinacci(fib_number - 2) | |
end | |
puts fibinacci(1) #output 1 | |
puts fibinacci(3) #output 3 | |
puts fibinacci(5) #output 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Ruby | |
def to_post_pre_fix(infix, isPost = true) | |
op_stack = [] #宣告成stack | |
return_str = "" #宣告成string | |
index_i=0 | |
while (index_i < infix.size) | |
if (infix[index_i] == ")") | |
return_str << op_stack.pop #string operator add to back | |
elsif ("+-*/".include? infix[index_i]) | |
isPost ? op_stack.push(infix[index_i]) : return_str << infix[index_i] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
class aClass | |
{ | |
private: | |
int a1=1; | |
public: | |
aClass():a1(2), a2(3) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
class L | |
{ | |
private: | |
int a1=1; | |
public: | |
L():a1(2), a2(a1) //Don't use like this, a2 result depends on compiler | |
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mapper.CreateMap<DTOObject, MainObject>().ForMember( | |
d => d.TopObject, | |
mc => mc.MapFrom(s => new SubObject(){ | |
SubPropText = s.TopText, | |
SubPropFont = s.TopFont | |
} | |
)); | |
//--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace WindowsFormsApplication1 | |
{ | |
static class Program | |
{ |
OlderNewer