📄 ch2_6_1.htm
字号:
<! Made by Html Translation Ver 1.0>
<HTML>
<HEAD>
<TITLE> 交谈式的输入 </TITLE>
</HEAD>
<BODY BACKGROUND="bg0000.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/bg0000.gif">
<FONT COLOR="#0000FF">
<H1>2.6.1 交谈式的输入</H1>
</FONT>
<HR>
<P>
我们来看一个已经讲过的算式:要计算面积 Area=<IMG SRC="img00006.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img2/img00006.gif">,可利用指令<FONT COLOR=#FF0000>input</FONT>在萤幕印出提示文字做为交谈式的输入。
<P>
<FONT COLOR=#FF0000>>> r = input('Type radius:') % 在两个单引号
' 之间键入提示文字</FONT>
<P>
<FONT COLOR=#FF0000>Type radius: % 现在键入 2 做为半径值</FONT>
<P>
<FONT COLOR=#FF0000>r =</FONT>
<P>
<FONT COLOR=#FF0000>2</FONT>
<P>
<FONT COLOR=#FF0000>>> area=pi*r^2; % 键入面积算式</FONT>
<P>
<FONT COLOR=#FF0000>>> name = input('Your name please: ','s')
% 要键入文字则须在加上's',s 是代表字串(string)</FONT>
<P>
<FONT COLOR=#FF0000>Your name please: % 键入名字 J.C. Wu</FONT>
<P>
<FONT COLOR=#FF0000>name =</FONT>
<P>
<FONT COLOR=#FF0000>J.C. Wu<BR>
</FONT><HR>
<A HREF="ch2_6.htm" tppabs="http://166.111.167.223/computer/cai/matlabjc/ch2_6.htm"><IMG SRC="lastpage.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/lastpage.gif" BORDER=0></A>
<A HREF="ch2_6_2.htm" tppabs="http://166.111.167.223/computer/cai/matlabjc/ch2_6_2.htm"><IMG SRC="nextpage-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/nextpage.gif" BORDER=0 HSPACE=10></A>
<A HREF="index.html" tppabs="http://166.111.167.223/computer/cai/matlabjc/index.html"><IMG SRC="outline-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/outline.gif" BORDER=0 HSPACE=6></A><BR>
<FONT SIZE=2 COLOR=#AA55FF> 上一页 下一页 讲义大纲 </FONT>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -