NS2 Tcl语言基础知识加深强化
来源:互联网 发布:php面向对象编程 编辑:程序博客网 时间:2024/04/20 03:16
1 if和输入输出
puts -nonewline "Please input a number: " ;#-nonewline表示不换行
flush stdout ;#清空输出缓冲区set x [gets stdin] ;#把输入的数字赋值给x
if { $x<0 } then {
puts "The input number $x less than 0"
} elseif { $x == 0 } {
puts "The input number $x equal 0"
} else {
puts "The input number $x bigger than 0"
}
2 break
puts -nonewline "Please input a number: "
flush stdout
set x [gets stdin]
set j 0
for { set i 0 } { $i < $x } { incr i } {
if { $i > 10 } { ;# 特别注意这一点的括号啊 一个也不能少啊,少一个就运行错误 continue也是一样的
continue
}
set j [expr $j + $i]
}
puts $j
3 continue
puts -nonewline "Please input a number: "
flush stdout
set x [gets stdin]
set j 0
for { set i 0 } { $i < $x } { incr i } {
if { $i == 11 } {
continue
}
set j [expr $j + $i]
}
puts $j
0 0
- NS2 Tcl语言基础知识加深强化
- ns2中的脚本语言Tcl的基础知识<1>
- ns2脚本语言Tcl的扩展语言Otcl简单介绍<2>
- Ns2 Tcl语法总结
- NS2 TCL传值到C++
- Tcl&NS2学习笔记
- Tcl&NS2学习笔记
- 初识NS2.34的tcl
- ns2 Tcl脚本程序解析
- 网络仿真NS2之——TCL语言介绍与实践
- tcl语言
- TCL语言
- tcl语言
- TCL语言
- NS2使用tcl脚本debug工具tcl-debug-2.0
- NS2无线脚本(~ns\tcl\ex\simple-wireless.tcl)
- NS2调试器tcl-debug的安装
- NS2中tcl脚本文件分析(转)
- Matlab基本函数-log10函数
- RDF N-元组
- zoj3464 Rugby Football(贪心)
- 各类语言编写的HelloWorld>程序
- 黑马程序员_ 正则表达式(笔记)
- NS2 Tcl语言基础知识加深强化
- windows8商店应用程序开发数据绑定
- SPFA判断负权回路+uva558
- linux c/c++ 加油站
- Matlab基本函数-menu函数
- .vimrc
- EF 向SQL SERVER 新增数据时报字段值过大
- 适配器模式
- String.valueOf()[新的判空语句]