亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? apa.htm

?? /// //Visual C++ 6.0 21天自學教程
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<STRONG>NOTE:</STRONG> It is always advisable to differentiate your global and local	variables by prefixing them with a g for global and l for local. <HR></BLOCKQUOTE><H2><A NAME="Heading5"></A>Pointers</H2><P>Pointers are one of the most important features of C++, and they are always confusingto new programmers of C++. Pointers work by providing access to the original datadirectly, which increases efficiency. Pointers primarily work with two operators,the indirection operator (*) and the address-of operator (&amp;). It is common practiceto add a p to the beginning of a pointer variable's name to distinguish it from othervariables. A pointer is just another variable, but the difference is it holds a memoryaddress. You declare a pointer by putting an asterisk (*) in front of the pointername. To access the address of the variable, you put the &amp; operator in frontof the variable name.</P><P>To understand pointers, you need a brief overview of how variables are stored.You covered different variable types in Table A.1. Table A.4 shows the size of thevariable types.</P><P><H4>TABLE A.4. VARIABLE TYPE SIZES.</H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT"><I>Variable Type</I></TD>		<TD ALIGN="LEFT"><I>Size in Bytes</I></TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">unsigned short int</TD>		<TD ALIGN="LEFT">2 bytes</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">short int</TD>		<TD ALIGN="LEFT">2 bytes</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">unsigned long int</TD>		<TD ALIGN="LEFT">4 bytes</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">long int</TD>		<TD ALIGN="LEFT">4 bytes</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">int</TD>		<TD ALIGN="LEFT">4 bytes (32 bit)</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">unsigned int</TD>		<TD ALIGN="LEFT">2 bytes(32 bit)</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">char</TD>		<TD ALIGN="LEFT">1 byte</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">float</TD>		<TD ALIGN="LEFT">4 bytes</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">double</TD>		<TD ALIGN="LEFT">8 bytes</TD>	</TR></TABLE></P><P>In the program address.cpp in Listing A.5, the two variables base and radius eachoccupy 8 and 4 bytes. Assume that your computer memory has a certain space to storethese variables, they are sequentially numbered from 1 through 12, and each spaceis 1 byte. When you declare the variable base of type double, it occupies 8 bytes.Assume these 8 bytes reside at locations beginning from 1 through 8. You also declaredanother variable radius of type int, which occupies 4 bytes and its location is byte9 through byte 12. The location of each of these variables is termed as its address.Hence, the variable base has an address beginning at address 1 and ending at address8. Similarly, the variable radius has an address beginning at address 9 and endingat address 12. When you use the address-of operator (&amp;) on a variable, this isthe address returned. The variable base has an address from 1 through 8, but theaddress-of operator returns its address as 1. Internally, the system already knowsthat the total addresses occupied are 8 because you defined its type as double.</P><BLOCKQUOTE>	<P><HR><STRONG>NOTE:</STRONG> The byte size shown in Table A.4 is not fixed. It can be different	depending on your compiler and the hardware on which it runs. To determine the size	of the variable for your individual compiler and hardware settings, use the sizeof()	function as implemented in Listing A.5 on lines 13 and 16. <HR></BLOCKQUOTE><P>The program in Listing A.5 shows how to access the memory address of variables.</P><P><H4>LISTING A.5. Address.cpp.</H4><PRE> 1: // Workspace:  Pointers 2: // Program name:  Address.cpp 3:  4: #include &lt;iostream.h&gt; 5:  6: double base = 5.0; 7: int radius = 2; 8:  9: void main()10: {11: cout&lt;&lt;&quot;The VALUE of base is: &quot;&lt;&lt;base&lt;&lt;endl;12: cout&lt;&lt;&quot;The ADDRESS of base is: &quot;&lt;&lt;&amp;base&lt;&lt;endl;13: cout&lt;&lt;&quot;The SIZE of double base is: &quot;&lt;&lt;sizeof(double)&lt;&lt; &quot;bytes \n&quot;;14: cout&lt;&lt;&quot;The VALUE of radius is: &quot;&lt;&lt;radius&lt;&lt;endl;15: cout&lt;&lt;&quot;The ADDRESS of radius is: &quot;&lt;&lt;&amp;radius&lt;&lt;endl;16: cout&lt;&lt;&quot;The SIZE of integer radius is: &quot;&lt;&lt;sizeof(int)&lt;&lt;&quot; bytes \n&quot;;17: }</PRE><P>The address of the variables is accessed directly on lines 12 and 15 by usingthe address-of operator (&amp;).The addresses of the variables base and radius areshown in Figure A.8. The addresses of the variables depend on your system, so theymight not be the same.</P><P><A HREF="javascript:popUp('0afig08.gif')"><B>FIGURE A.8.</B></A><B> </B><I>Usingthe address-of operator.</I></P><P>The indirection operator (*) operates by providing access to the value storedin the address of the variable. When a pointer is declared for a specific variabletype (such as int), it should not be used with any other type unless it is recastto a new type. You should remember that a pointer is a variable, and like all othervariables, it should be declared and initialized. A pointer that is not initializedcould be dangerous. The program in Listing A.5 is modified to access the values ofthe variables radius and base. The modified program is provided in Listing A.6.</P><P><H4>LISTING A.6. Address.cpp.</H4><PRE> 1: // Workspace:  Pointers</PRE><PRE> 2: // Program name:  Address.cpp 3:  4: #include &lt;iostream.h&gt; 5:  6: double base =5.0; 7: int radius =2; 8:  9: double *pBase =0;           // Initialize the pointer variable10: int *pRadius =0;            // Initialize the pointer variable11: 12: void main()13: {14: pBase = &amp;base;                   // Assign the address of base15: pRadius = &amp;radius;               // Assign the address of radius16: cout&lt;&lt;&quot;The VALUE of base is: &quot;&lt;&lt;base&lt;&lt;endl;    // Output value of base17: cout&lt;&lt;&quot;The ADDRESS of base is: &quot;&lt;&lt;&amp;base&lt;&lt;endl; // Output address of           &Acirc;base18: cout&lt;&lt;&quot;The SIZE of double base is: &quot;&lt;&lt;sizeof(double)&lt;&lt; &quot;bytes \n 19: cout&lt;&lt;&quot;The VALUE of pBase is: &quot;&lt;&lt;*pBase&lt;&lt;endl;  	            &Acirc; // Output redirected value of base20: 21: cout&lt;&lt;&quot;The VALUE of radius is: &quot;&lt;&lt;radius&lt;&lt;endl;     	            &Acirc;// Output value of radius22: cout&lt;&lt;&quot;The ADDRESS of radius is: &quot;&lt;&lt;&amp;radius&lt;&lt;endl;   	            &Acirc;// Output address of base23: cout&lt;&lt;&quot;The SIZE of integer radius is: &quot;&lt;&lt;sizeof(int)&lt;&lt;&quot; bytes \n&quot;; 24: cout&lt;&lt;&quot;The VALUE of pRadius is: &quot;&lt;&lt;*pRadius&lt;&lt;endl;  	            &Acirc;// Output redirected value of radius25: 26: }</PRE><H3><A NAME="Heading6"></A>References</H3><P>An important feature in C++ that is used often with function parameters is <I>references</I>.Reference is simply a synonym for variable. Until now, you have passed parametersin functions by value. You will learn how to pass parameters by reference. You createa reference variable by specifying its type and preceding the name with the referenceoperator (&amp;). If you have a variable float radius, you create a reference with</P><P><PRE>void functionname (float &amp;rfradius);</PRE><P>You can give the reference variable any name you want; in the following example,the reference variable names have an rf prefix. The advantage of a reference is thatyou can pass it as a parameter, like any other variable. However, unlike regularparameters, changes made to the reference's value while in a function are storedin the original variable. The example in Listing A.7 shows how the reference changesthe value of the variable in the main() function.</P><P><H4>LISTING A.7. Refer.cpp.</H4><PRE> 1: // Workspace:  Reference 2: // Program name:  Refer.cpp 3:  4: #include &lt;iostream.h&gt; 5:  6: void squareit (float &amp;num); 7: int main() 8:  9: {10: float num=5.0;11: 12: cout&lt;&lt;&quot;In Main: before squaring number: &quot;&lt;&lt;num*num&lt;&lt;&quot;\n&quot;;13: 14: squareit (num);15: cout&lt;&lt;&quot;In Main: after squaring number: &quot;&lt;&lt;num*num&lt;&lt;&quot;\n&quot;;16: return 0;17: 18: }19: 20: void  squareit (float &amp;rfnum)21: {22: 23: cout&lt;&lt;&quot;In Squareit: before squaring number: &quot;&lt;&lt;rfnum*rfnum&lt;&lt;&quot;\n&quot;;24: 25: rfnum = rfnum+5;26: 27: cout&lt;&lt;&quot;In Squareit: after squaring number: &quot;&lt;&lt;rfnum*rfnum&lt;&lt;&quot;\n&quot;;28: 29: }</PRE><P>You define a function squareit on line 6, and its parameters are references. Thisis the function prototype. On line 10, the variable num is given a value of 5. Thesquare of the number is displayed to the screen on line 15. On line 14, you callthe squareit function.</P><BLOCKQUOTE>	<P><HR><STRONG>NOTE:</STRONG> You pass the variable num and not its address. <HR></BLOCKQUOTE><P>Only when execution jumps to line 20 from line 14 are the variables identifiedas references. On line 27, the references are squared and displayed. They shouldbe the same as the variables because they are just like aliases for the variables.On line 25, you add 5 to the reference, which in turn changes the variable num. Theincremented value is squared and displayed to the screen. Execution returns to main()on line 15, where the display confirms the variable was changed. The output for thisprogram is shown in Figure A.9.</P><P><A HREF="javascript:popUp('0afig09.gif')"><B>FIGURE A.9.</B></A><B> </B><I>Passingparameters by reference.</I><DL>	<P></DL><H2><A NAME="Heading7"></A>Classes</H2><P>In the previous sections, you used data types (int, float, and so on) that areinherently built into C++. In large complex programs, it is easier to define yourown type, which could be a combination of the inherent types. Classes were addedto C++ primarily for this purpose--to enable the programmer to be able to definecustom data types and methods. The concept of classes in C++ evolved due to certainlimitations of the concept of structures in C. To thoroughly understand classes,you have to step back into C and understand structures first.</P><P>A structure in C/C++ is a way of representing your own custom data. When you definedvariables, you first defined their data types, followed by their names:</P><P><PRE>int radius;</PRE><P>To define your own data types, you use the keyword struct. The syntax for declaringa structure is</P><P><PRE><I>struct</I> [<I>structure_name</I>]  {  <I>data_members</I>  }</PRE><P>The <I>data_members</I> of a structure are variables and functions. When functionsare associated with classes, they are more appropriately referred to as methods.From now on, you use the term function for program code that is not a part of a structureor class. A reference to methods indicates that the function is associated with aclass structure. To understand how structures are used, review the example in ListingA.8.</P><P><H4>LISTING A.8. Struct.cpp.</H4><PRE> 1: // Workspace Name: Class1 2: // Program Name:  Struct.cpp 3: #include &lt;iostream.h&gt; 4:  5: struct farm_house  6: { 7: int pig_values; 8: }; 9: 10: int main()11: {12: farm_house pig1, pig2, pig3;13: 14: pig1.pig_values = 12;15: pig2.pig_values = 13;16: pig3.pig_values = 14;17: 18: cout &lt;&lt; &quot;The value of pig1 is &quot; &lt;&lt; pig1.pig_values&lt;&lt; &quot;\n&quot;;19: cout &lt;&lt; &quot;The value of pig2 is &quot; &lt;&lt; pig2.pig_values &lt;&lt; &quot;\n&quot;;20: cout &lt;&lt; &quot;The value of pig3 is &quot; &lt;&lt; pig3.pig_values &lt;&lt; &quot;\n&quot;;21:  22: return 0;23: }.</PRE><P>On line 5, the struct keyword is followed by the name of the structure. The actualdefinition of the structure is enclosed in the curly brackets. This particular structuredefines a data member of type int and name pig_value. If you remember, I mentionedearlier that when you define a structure, you basically define a custom-made datatype. All data types end with a semicolon, so the structure should also end witha semicolon. On line 12, you define three instances of the same type of farm_house,each of which contains a single int type variable.</P><BLOCKQUOTE>	<P><HR><STRONG>NOTE:</STRONG> If you strictly use C, then to define instances on line 12,	you must use the keyword struct:</P>	<PRE>struct farm_house pig1, pig2, pig3;</PRE></BLOCKQUOTE><PRE></PRE><BLOCKQUOTE>	<P>This is no longer required in C++. <HR></BLOCKQUOTE><P>On lines 14 through 16, you assign values to the member variables of each structure.The structure member operator (.), also called the dot operator, is used to accessmember variables of the structure. On lines 18 through 20, the assigned values areoutput to the screen. Figure A.10 shows the output from this program.</P><P><A HREF="javascript:popUp('0afig10.gif')"><B>FIGURE A.10.</B></A><B> </B><I>Structureoutput.</I></P><P>The most important concept of object-oriented programming is encapsulation. Encapsulationcan involve one or more classes. Encapsulation promotes safeguards and data hiding.The struct.cpp program had no encapsulation or classes. What do encapsulation andclasses mean in object-oriented programming?</P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人激情社区| 色欧美乱欧美15图片| 91色.com| 日韩免费一区二区| 成人免费小视频| 国产精品一区专区| 欧美日本一区二区三区| 亚洲欧美自拍偷拍| 国产高清无密码一区二区三区| 欧美三级电影在线看| 中文字幕免费观看一区| 激情综合五月婷婷| 欧美人伦禁忌dvd放荡欲情| 国产精品日日摸夜夜摸av| 黄色资源网久久资源365| 欧美丰满少妇xxxbbb| 亚洲精品成人悠悠色影视| 韩日欧美一区二区三区| 欧美一级精品在线| 午夜电影久久久| 在线观看视频欧美| 中文字幕在线视频一区| 国产成人免费av在线| 欧美精品一区二区三| 久久99精品久久久久婷婷| 欧美一区二区三区在线看| 亚洲444eee在线观看| 欧美日韩一二三| 午夜不卡av免费| 91精品啪在线观看国产60岁| 天堂va蜜桃一区二区三区漫画版| 欧美日韩一区精品| 午夜欧美2019年伦理| 欧美揉bbbbb揉bbbbb| 亚洲图片一区二区| 欧美精品丝袜中出| 青青草国产精品97视觉盛宴| 日韩精品综合一本久道在线视频| 美美哒免费高清在线观看视频一区二区 | 午夜久久电影网| 3d动漫精品啪啪一区二区竹菊| 爽好久久久欧美精品| 欧美一级片免费看| 国产乱子轮精品视频| 精品第一国产综合精品aⅴ| 国产又粗又猛又爽又黄91精品| 国产网站一区二区三区| 成人免费va视频| 一区二区三区在线高清| 欧美日韩高清在线播放| 蜜臀91精品一区二区三区| 久久综合九色综合欧美就去吻| 国产·精品毛片| 亚洲一区二区三区在线| 欧美成人a∨高清免费观看| 国产suv精品一区二区三区| 亚洲视频每日更新| 欧美一卡2卡三卡4卡5免费| 国产aⅴ综合色| 亚洲国产中文字幕在线视频综合| 欧美一区二区三区四区在线观看| 国产精品一区二区久激情瑜伽 | www.亚洲国产| 亚洲一区二区三区视频在线播放 | 日本高清不卡在线观看| 日韩高清一区二区| 国产精品热久久久久夜色精品三区 | 国产福利一区二区| 亚洲第一会所有码转帖| 26uuu亚洲婷婷狠狠天堂| 91麻豆国产精品久久| 美女视频网站久久| 亚洲欧美日韩久久| 久久久亚洲欧洲日产国码αv| 欧美伊人久久久久久午夜久久久久| 久久精品国产亚洲a| 亚洲日本乱码在线观看| 久久亚洲一区二区三区四区| 色婷婷av一区二区三区软件 | 久久久噜噜噜久久中文字幕色伊伊| 91麻豆国产精品久久| 韩国v欧美v日本v亚洲v| 亚洲精品成人精品456| 久久久www免费人成精品| 欧美色涩在线第一页| 波多野结衣中文字幕一区二区三区| 午夜精彩视频在线观看不卡| 中文字幕色av一区二区三区| 精品国产一区二区在线观看| 欧美日韩亚洲综合在线| 99re热视频精品| 国产成人午夜高潮毛片| 美国一区二区三区在线播放| 亚洲国产综合在线| 亚洲黄色小说网站| 国产精品日日摸夜夜摸av| 久久久综合激的五月天| 日韩午夜精品视频| 制服丝袜亚洲色图| 欧美性欧美巨大黑白大战| av激情成人网| 91伊人久久大香线蕉| 成人免费视频免费观看| 国产在线精品一区二区| 另类人妖一区二区av| 日本中文一区二区三区| 五月天一区二区| 五月天婷婷综合| 日日夜夜免费精品| 青青青爽久久午夜综合久久午夜 | 7777精品伊人久久久大香线蕉超级流畅| 不卡的av网站| 97精品视频在线观看自产线路二| a级精品国产片在线观看| 国产sm精品调教视频网站| 成人一区二区三区视频| 成人av网站大全| 97超碰欧美中文字幕| 色综合久久久久综合99| 欧美在线观看视频在线| 欧洲视频一区二区| 欧美妇女性影城| 337p粉嫩大胆色噜噜噜噜亚洲 | 国产精品18久久久久久久久| 国产精品911| caoporen国产精品视频| 91久久精品日日躁夜夜躁欧美| 91久久国产综合久久| 91精品国产色综合久久不卡蜜臀 | 亚洲黄色免费网站| 亚洲国产精品一区二区尤物区| 亚洲自拍都市欧美小说| 五月开心婷婷久久| 久久99久久精品欧美| 国产精品一级黄| 色就色 综合激情| 日韩欧美中文一区| 国产欧美日韩激情| 亚洲美女免费视频| 久久99国产精品免费| 成人免费毛片a| 欧美日本一区二区三区| 久久综合九色综合97婷婷女人| 国产精品久久三区| 免费欧美在线视频| www.66久久| 在线综合+亚洲+欧美中文字幕| 26uuu国产在线精品一区二区| 国产精品色眯眯| 日本不卡视频在线观看| 国产成人av电影在线播放| 欧美性一区二区| 国产丝袜欧美中文另类| 亚洲午夜日本在线观看| 国产乱码精品一区二区三区忘忧草| 色综合久久久久网| 久久久综合视频| 午夜激情久久久| 国产a视频精品免费观看| 欧美精品日韩一区| 中文字幕亚洲视频| 久久99精品视频| 欧亚一区二区三区| 久久精品视频在线免费观看 | 亚洲色图在线看| 韩国三级在线一区| 欧美亚洲综合久久| 中文字幕中文字幕在线一区| 免费在线观看视频一区| 在线观看一区二区视频| 国产欧美va欧美不卡在线| 日韩精品一区第一页| 91精品办公室少妇高潮对白| 日本一区二区三区四区在线视频| 无码av中文一区二区三区桃花岛| av不卡在线播放| 久久久久久久久久看片| 青草国产精品久久久久久| 欧美专区日韩专区| 亚洲欧美另类小说| 成人avav影音| 国产精品久久久久久福利一牛影视| 国模无码大尺度一区二区三区| 欧美精品一卡两卡| 亚洲国产日韩a在线播放性色| 91在线国产福利| 国产精品久久久一本精品| 国产成人综合在线观看| 久久综合久色欧美综合狠狠| 视频一区在线视频| 6080国产精品一区二区| 午夜av一区二区| av一区二区三区黑人| 国产精品视频一二三区| 国产高清一区日本| 国产精品高潮呻吟| 99久久er热在这里只有精品66| 国产婷婷色一区二区三区| 丁香六月久久综合狠狠色| 欧美国产日韩亚洲一区|