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

📄 c++ tutorial by clayman.html

📁 黑客培训教程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
    </font> <br>

    <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; This line simply 

    tells the computer that the iostream library is needed therefore it should 

    be included. A library is a collection of program code that can be included 

    (and used) in a program to perform a variety of tasks. iostream is a library 

    - also called as a header file, look at its extension - used to perform input/output 

    (I/O) stream tasks. There are a lot of non-commercial C++ libraries for various 

    purposes written by good guys who spent more than enough time in front of 

    their computers. You can find them at code.box.sk. Also references to all 

    libraries used in the tutorials can be found on the net.<br>

    </font> <br>

    <strong><font color="#FFFFFF">2.5. Functions</font></strong><font color="#FFFFFF"><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">The next line in the program was:<br>

    </font> <br>

    <font color="#FFFFFF">&nbsp;&nbsp;&nbsp; int main()<br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; Which is the 

    header of the main function. Makes sense? No? A function is a set of statements 

    that accomplish a task. A function header includes the return type of the 

    function and the function name. As shown in the main() header, main returns 

    an integer(int) through return(0). So all the functions that have an integer 

    as the return type returns integers. Very clear. The statements in a function 

    (in this case the main function) are enclosed in curly braces. The { and } 

    symbols indicates the beginning and the end of statements. More on functions 

    later.<br>

    </font> <br>

    <strong><font color="#FFFFFF">2.6. Streams</font></strong><font color="#FFFFFF"><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; What is a stream? 

    In C++ input/output devices are called streams. cout (we used above) is the 

    c(onsole) out(put) stream, and the send (insertion) operator is used to send 

    the data "We own you" into the stream. In the first statement:<br>

    </font> <br>

    <font color="#FFFFFF">&nbsp;&nbsp;&nbsp; cout&lt;&lt;"We own you";<br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; The words following 

    the &lt;&lt; operator are put in quotation marks(") to form a string. When 

    run, the string We own you is sent to the console output device. Yes, it is 

    also called the computer screen.<br>

    </font> <br>

    <strong><font color="#FFFFFF">Important note: C++ is case sensitive. That 

    means cout and Cout is not the same thing.</font></strong><font color="#FFFFFF"><br>

    <br>

    <strong>2.7. Return</strong><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">The second statement was:<br>

    </font> <br>

    <font color="#FFFFFF">&nbsp;&nbsp;&nbsp; return(0);<br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">which causes the program to terminate 

    sending the value 0 to the computer. The value "0" indicates that the program 

    terminated without error.<br>

    </font> <br>

    <font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><b>Note:</b></font><font face="Arial, Helvetica, sans-serif"> 

    The statements end with a semicolon (;). A semicolon in C++ indicate the end 

    of a statement.</font><font face="Arial, Helvetica, sans-serif"><br>

    </font></font><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><br>

    <a name=datandnumsystems><strong>3. DATA &amp; NUMBER SYSTEMS</strong></a><br>

    <br>

    <strong>3.1. Decimals</strong><br>

    <br>

    </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; 

    The base 10 number system. Uses 10 digits: 0 to 9. Numbers raised to the zero 

    power is equal to one. For example: 5 to the power 0 = 1. Base ten equivalent 

    of the number <br>

    </font> <br>

    2600 =&nbsp;&nbsp;&nbsp;&nbsp; 2 x (10 to the power 3) + 6 x (10 to the power 

    2)<br>

    33 =&nbsp;&nbsp;&nbsp; 3 x (10 to the power 1) + 3 x (10 to the power 0)<br>

    <br>

    <strong><font color="#FFFFFF">3.2. Binaries</font></strong><font color="#FFFFFF"><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; The base 2 number 

    system. Uses 2 digits : 0 and 1. Works the same as base 10 except we multiply 

    numbers by the powers of 2 instead. For example 110 is equal to 6 in base 

    10:<br>

    </font> <br>

    110 =&nbsp;&nbsp;&nbsp; 1 x (2 to the power 2) + 1 x (2 to the power 1) = 

    6(base10)<br>

    <br>

    <strong><font color="#FFFFFF">3.3. Hexadecimal</font></strong><font color="#FFFFFF"><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; The base 16 number 

    system. Uses 16 digits. 0 to 9 &amp; "A" to "F". Works the same as base 10 

    &amp; base two except the numbers are multiplied by the powers of 16 instead:<br>

    </font> <br>

    1B =&nbsp;&nbsp;&nbsp; 1 x (16 to the power 1) + 2(B) x (16 to the power of 

    0) = 30(base10)<br>

    </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>

    <font color="#FFFFFF"><a name=exercises><strong>4. EXERCISES</strong></a><br>

    <br>

    <strong>4.1. Running</strong><br>

    <br>

    </font> <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; Find 

    &amp; install a compiler, type the example program and run it. Pretty simple 

    but be sure the syntax is correct.<br>

    </font> <br>

    <strong><font color="#FFFFFF">4.2. Typing</font></strong><font color="#FFFFFF"><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp; Make a program 

    which displays your name without looking to this tutorial. Makes you learn 

    a lot better.<br>

    </font> <br>

    <strong><font color="#FFFFFF">4.3. Converting</font></strong><font color="#FFFFFF"><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">Convert these to decimals &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

    : 110101, 001101, 10101110<br>

    Convert these to hexadecimals&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 234, 324, 

    19394<br>

    Convert these to binaries&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

    &nbsp;&nbsp; : 2F, 1B3, 234, 125<br>

    </font> <br>

    <br>

    <font color="#FFFFFF"><a 

      name=whatnow><strong>5. WHAT NOW?</strong></a><br>

    &nbsp;&nbsp;&nbsp; <br>

    <strong>5.1. Good programming related sites</strong><br>

    </font> <br>

    <font face="Arial, Helvetica, sans-serif">Here are a few good sites about 

    programming:<br>

    </font> </font></p>

  <div align="left"> 

    <table border=0 cellpadding=2 cellspacing=2 width="100%">

      <tbody> 

      <tr bgcolor="#000000"> 

        <td width="252"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a 

            href="http://code.box.sk/">http://code.box.sk</a></font></td>

        <td width="688"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">--&gt; 

          Very good content. Has message boards.</font></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="252"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a 

            href="http://www.borland.com/">http://www.borland.com</a></font></td>

        <td width="688"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">--&gt; 

          Free, shareware &amp; commercial compilers.</font></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="252"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a 

            href="http://www.cprogramming.com/">http://www.cprogramming.com</a></font></td>

        <td width="688"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">--&gt; 

          Some original tuts.</font></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="252"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a 

            href="http://www.planet-source-code.com/">http://www.planet-source-code.com</a></font></td>

        <td width="688"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">--&gt; 

          One of the biggest code archive.</font></td>

      </tr>

      </tbody> 

    </table>

  </div>

  <p align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>

    <strong><font color="#FFFFFF">5.2. Good books on C++</font></strong><font color="#FFFFFF"><br>

    </font> </font></p>

  <div align="left"> 

    <table border=0 cellpadding=2 cellspacing=2 width="100%">

      <tbody> 

      <tr bgcolor="#000000"> 

        <td height=20 

width="500"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><strong>Printed:</strong></font></td>

        <td height=20 width="56%"></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="500"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a 

            href="http://www.amazon.com/exec/obidos/ASIN/0135289106/thetomegamingsit">C++ 

          - How to Program</a></font></td>

        <td width="56%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">One 

          of the best books written on C. Great for all levels of programming.</font></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="500" height="19"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a 

            href="http://www.amazon.com/exec/obidos/ASIN/0078824761/thetomegamingsit">C++: 

          The complete reference</a></font></td>

        <td width="56%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">An 

          overall C++ &amp; STL reference</font></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="500"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a 

            href="http://www.amazon.com/exec/obidos/ASIN/1879233916/thetomegamingsit">A 

          Guide to Programming in C++, Lawrenceville Press</a></font></td>

        <td width="56%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">My 

          first book on C++, "borrowed" lots of definitions from there :)</font></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="500"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><strong><br>

          Online books:</strong></font></td>

        <td width="56%"></td>

      </tr>

      <tr bgcolor="#000000"> 

        <td width="500" height="7"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Thinking 

          in C++ is nearly the best one on C++, a must-read.</font></td>

        <td width="56%" height="7"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You 

          can find many online netbooks from <a 

            href="http://code.box.sk/">code.box.sk </a></font></td>

      </tr>

      </tbody> 

    </table>

  </div>

  <p align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>

    <font color="#FFFFFF"><strong>Thanks to:</strong><br>

    <br>

    </font> --&gt;Cube, to provide such valuable information in the <a 

      href="http://www.boxnetwork.net/">boxnetwork</a> sites.<br>

    --&gt;all guys at Neworder's Message board, for asking tutorials.<br>

    <br>

    <strong><font color="#FFFFFF">Ke Bea(!?) to:</font></strong><font color="#FFFFFF"><br>

    </font> --&gt;all friends in the Koch Part-time Prison.</font></p>

  <p align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><strong><font color="#FFFFFF">END 

    OF TUTORIAL</font></strong><font color="#FFFFFF"><br>

    </font> If you want to add something or modify the tutorial in any way please 

    e-mail me first: <a 

      href="mailto:clayman@boxnetwork.net">clayman@boxnetwork.net</a>. Feel 

    free to distribute this as you wish.<br>

    <br>

    </font></p>

</center>

</body>

</html>

⌨️ 快捷键说明

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