제 프로그램 개선을 제안하십시오. 이 프로그램은 4 비트 바이너리 증분 o/p를 제공합니다 불필요한 코드가있는 곳에서 최적화를 찾고 있습니다.순차 바이너리 TCL
제 프로그램 개선을 제안하십시오. 이 프로그램은 4 비트 바이너리 증분 o/p를 제공합니다 불필요한 코드가있는 곳에서 최적화를 찾고 있습니다. 내 프로그램 개선을 제안하십시오. 이 프로그램은 4 비트 바이너리 증분 o/p를 제공합니다 불필요한 코드가있는 곳에서 최적화를 찾고 있습니다.
#!/bin/sh
# This
puts "+++++++++++++++++\n"
set ipaddr "0.0.0.0"
set limit 4
set splitip [split $ipaddr "."]
puts "Split ip address = $splitip"
# MAIN ROUTINE
set ilength [llength $splitip]
puts "Length of string is $ilength"
set first [lindex $splitip 0]
set sec [lindex $splitip 1]
set third [lindex $splitip 2]
set four [lindex $splitip 3]
for { set limit 1} { $limit >0} {} {
for { set first $first } { $first <= $limit} {} {
for { set sec $sec } { $sec <= $limit} {} {
for { set third $third } { $third <= $limit} {} {
for { set four $four } { $four <= $limit} {} {
puts " f:$first $sec $third $four"
incr four
}
set four 0
incr third; #puts " t:$four $third $sec $first\n"
}
set third 0
incr sec
}
#puts " f:$four $third $sec $first"
set sec 0
incr first
}
incr limit -1
}
# End Main
puts "\n++++++End Program+++++++++++"
는, 어쩌면 한 번 봐 가지고 : 당신의 의도는 이진수의 순서를 인쇄 할 경우 최종 참고로
는,이 방법으로 그렇게하기 훨씬 쉽다 tcllib ip 패키지도 있습니다. (http://tcllib.sourceforge.net/doc/tcllib_ip.html) – schlenk그 링크에 대해 감사합니다 schlenk. – user3211264