⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getting interactive input.htm

📁 点net代码20个
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Getting Interactive Input</title>
</head>

<body background="../basic3.gif">

<table border="0" cellspacing="0" width="596">
  <tr>
    <td align="center"><font color="#FF0000" size="4">Getting Interactive Input</font></td>
  </tr>
  <tr>
    <td> 
      <p><font color="#008000">// Namespace Declaration<br>
      using System;<br>
      <br>
      // Program start class<br>
      class NamedWelcome {<br>
      <br>
      &nbsp;&nbsp;&nbsp; // Main begins program execution.<br>
      &nbsp;&nbsp;&nbsp; public static void Main() {<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Write to console/get input<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.Write(&quot;What is 
      your name?: &quot;);<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.Write(&quot;Hello, {0}! 
      &quot;, Console.ReadLine());<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(&quot;Welcome 
      to the C# Station Tutorial!&quot;);&nbsp;<br>
      <br>
      &nbsp;&nbsp;&nbsp; }<br>
      }<br>
      </font></td>
  </tr>
  <tr>
    <td>This time, the &quot;Main&quot; method doesn't have any parameters.&nbsp; 
      However, there are now three statements and the first two are different 
      from the third.&nbsp; They are &quot;Console.Write(...)&quot; instead of 
      &quot;Console.WriteLine(...)&quot;.&nbsp; The difference is that the 
      &quot;Console.Write(...)&quot; statement writes to the console and stops 
      on the same line, but the &quot;Console.WriteLine(...)&quot; goes to the 
      next line after writing to the console.&nbsp;&nbsp;</td>
  </tr>
  <tr>
    <td>The first statement simply writes &quot;What is your name?:&nbsp; &quot; 
      to the console.&nbsp;&nbsp;</td>
  </tr>
  <tr>
    <td>The second statement doesn't write anything until it's arguments are 
      properly evaluated.&nbsp; The first argument after the formatted string is 
      &quot;Console.ReadLine()&quot;.&nbsp; This causes the program to wait for 
      user input at the console, followed by a Return or Enter.&nbsp; The return 
      value from this method replaces the &quot;{0}&quot; parameter of the 
      formatted string and is written to the console.&nbsp;&nbsp;</td>
  </tr>
  <tr>
    <td>The last statement writes to the console as described earlier.&nbsp; 
      Upon execution of the command-line with &quot;InteractiveWelcome&quot;, 
      the output will be as follows:</td>
  </tr>
  <tr>
    <td>&gt;What is your Name?&nbsp; &lt;type your name here&gt;<br>
      &gt;Hello, &lt;your name here&gt;!&nbsp; Welcome to the C# Station 
      Tutorial!</td>
  </tr>
  <tr>
    <td>By now you know the basic structure of a C# program.&nbsp; You are 
      familiar with namespaces and classes.&nbsp; You know the &quot;Main&quot; 
      method is your entry point to start a C# program.&nbsp; You've also 
      learned how to capture command-line input and perform interactive I/O.</td>
  </tr>
  <tr>
    <td>This is just the beginning, the first of many lessons.&nbsp; I invite 
      you back to take Lesson 2:&nbsp; Expressions, Types, and Variables&nbsp; 
      (Now complete).&nbsp;</td>
  </tr>
  <tr>
    <td>Your feedback is very important and I appreciate any constructive 
      comments you have. Please feel free to contact me for any questions or 
      comments you may have about this lesson.</td>
  </tr>
</table>

</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -