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

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

?? ch21.htm

?? good book for learning c++ standard language
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>
<!-- This document was created from RTF source by rtftohtml version 3.0.1 -->

	<META NAME="GENERATOR" Content="Symantec Visual Page 1.0">
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
	<TITLE>Teach Yourself C++ in 21 Days</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF">

<H1 ALIGN="CENTER"><A HREF="ch20.htm" tppabs="http://petunia.atomki.hu/pio/Manuals/english/0-672/0-672-31070-8/htm/ch20.htm"><IMG SRC="../buttons/BLANPREV.GIF" tppabs="http://petunia.atomki.hu/pio/Manuals/english/0-672/0-672-31070-8/buttons/BLANPREV.GIF"
WIDTH="37" HEIGHT="37" ALIGN="BOTTOM" BORDER="0"></A><A HREF="javascript:if(confirm('http://www.mcp.com/sams  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.mcp.com/sams'" tppabs="http://www.mcp.com/sams"><IMG
SRC="../buttons/BLANHOME.GIF" tppabs="http://petunia.atomki.hu/pio/Manuals/english/0-672/0-672-31070-8/buttons/BLANHOME.GIF" WIDTH="37" HEIGHT="37" ALIGN="BOTTOM"
BORDER="0"></A><A HREF="../index.htm" tppabs="http://petunia.atomki.hu/pio/Manuals/english/0-672/0-672-31070-8/index.htm"><IMG SRC="../buttons/BLANTOC.GIF" tppabs="http://petunia.atomki.hu/pio/Manuals/english/0-672/0-672-31070-8/buttons/BLANTOC.GIF"
WIDTH="37" HEIGHT="37" ALIGN="BOTTOM" BORDER="0"></A><A HREF="ch21rv3.htm" tppabs="http://petunia.atomki.hu/pio/Manuals/english/0-672/0-672-31070-8/htm/ch21rv3.htm"><IMG SRC="../buttons/BLANNEXT.GIF" tppabs="http://petunia.atomki.hu/pio/Manuals/english/0-672/0-672-31070-8/buttons/BLANNEXT.GIF"
WIDTH="37" HEIGHT="37" ALIGN="BOTTOM" BORDER="0"></A></H1>
<H1></H1>

<UL>
	<LI><A HREF="#Heading1">Day 21</A>
	<UL>
		<LI><A HREF="#Heading2">Whats Next</A>
		<UL>
			<LI><A HREF="#Heading3">The Standard Libraries</A>
			<LI><A HREF="#Heading4">String</A>
			<LI><A HREF="#Heading5">Listing 21.1. strlen().</A>
			<UL>
				<LI><A HREF="#Heading6">strcpy() and strncpy()</A>
			</UL>
			<LI><A HREF="#Heading7">Listing 21.2. Using strcpy.</A>
			<LI><A HREF="#Heading8">Listing 21.3. Using strncpy().</A>
			<UL>
				<LI><A HREF="#Heading9">strcat() and strncat()</A>
			</UL>
			<LI><A HREF="#Heading10">Listing 21.4. Using strcat() and strncat().</A>
			<UL>
				<LI><A HREF="#Heading11">Other String Functions</A>
			</UL>
			<LI><A HREF="#Heading12">Time and Date</A>
			<LI><A HREF="#Heading13">Listing 21.5. Using ctime().</A>
			<LI><A HREF="#Heading14">stdlib</A>
			<LI><A HREF="#Heading15">Listing 21.6. Using atoi() and related functions.</A>
			<UL>
				<LI><A HREF="#Heading16">qsort()</A>
			</UL>
			<LI><A HREF="#Heading17">Listing 21.7. Using qsort().</A>
			<UL>
				<LI><A HREF="#Heading18">Other Libraries</A>
			</UL>
			<LI><A HREF="#Heading19">Bit Twiddling</A>
			<UL>
				<LI><A HREF="#Heading20">Operator AND</A>
				<LI><A HREF="#Heading21">Operator OR</A>
				<LI><A HREF="#Heading22">Operator Exclusive OR</A>
				<LI><A HREF="#Heading23">The Complement Operator</A>
				<LI><A HREF="#Heading24">Setting Bits</A>
				<LI><A HREF="#Heading25">Clearing Bits</A>
				<LI><A HREF="#Heading26">Flipping Bits</A>
				<LI><A HREF="#Heading27">Bit Fields</A>
			</UL>
			<LI><A HREF="#Heading28">Listing 21.8. Using bit fields</A><A HREF="#Heading29">.</A>
			<LI><A HREF="#Heading30">Style</A>
			<UL>
				<LI><A HREF="#Heading31">Indenting</A>
				<LI><A HREF="#Heading32">Braces</A>
				<LI><A HREF="#Heading33">Long Lines</A>
				<LI><A HREF="#Heading34">switch Statements</A>
				<LI><A HREF="#Heading35">Program Text</A>
				<LI><A HREF="#Heading36">Identifier Names</A>
				<LI><A HREF="#Heading37">Spelling and Capitalization of Names</A>
				<LI><A HREF="#Heading38">Comments</A>
				<LI><A HREF="#Heading39">Access</A>
				<LI><A HREF="#Heading40">Class Definitions</A>
				<LI><A HREF="#Heading41">include Files</A>
				<LI><A HREF="#Heading42">assert()</A>
				<LI><A HREF="#Heading43">const</A>
			</UL>
			<LI><A HREF="#Heading44">Next Steps</A>
			<UL>
				<LI><A HREF="#Heading45">Where to Get Help and Advice</A>
				<LI><A HREF="#Heading46">Required Reading</A>
				<LI><A HREF="#Heading47">Magazines</A>
				<LI><A HREF="#Heading48">Staying in Touch</A>
			</UL>
			<LI><A HREF="#Heading49">Summary</A>
			<LI><A HREF="#Heading50">Q&amp;A</A>
			<UL>
				<LI><A HREF="#Heading51">Quiz</A>
				<LI><A HREF="#Heading52">Exercises</A>
			</UL>
		</UL>
	</UL>
</UL>

<P>
<HR SIZE="4">

<H2 ALIGN="CENTER"><A NAME="Heading1"></A><FONT COLOR="#000077">Day 21</FONT></H2>

<H2 ALIGN="CENTER"><A NAME="Heading2"></A><FONT COLOR="#000077">Whats Next</FONT></H2>
<P>Congratulations! You are nearly done with a full three-week intensive introduction
to C++. By now you should have a solid understanding of C++, but in modern programming
there is always more to learn. This chapter will fill in some missing details and
then set the course for continued study.</P>
<P>Today you will learn

<UL>
	<LI>What the standard libraries are.
	<P>
	<LI>How to manipulate individual bits and use them as flags.
	<P>
	<LI>What the next steps are in learning to use C++ effectively.
</UL>

<H3 ALIGN="CENTER"><A NAME="Heading3"></A><FONT COLOR="#000077">The Standard Libraries</FONT></H3>
<P>Every implementation of C++ includes the standard libraries, and most include
additional libraries as well. Libraries are sets of functions that can be linked
into your code. You've already used a number of standard library functions and classes,
most notably from the <TT>iostreams</TT> library.</P>
<P>To use a library, you typically include a header file in your source code, much
as you did by writing <TT>#include &lt;iostream.h&gt;</TT> in many of the examples
in this book. The angle brackets around the filename are a signal to the compiler
to look in the directory where you keep the header files for your compiler's standard
libraries.</P>
<P>There are dozens of libraries, covering everything from file manipulation to setting
the date and time to math functions. Today I will review just a few of the most popular
functions and classes in the standard library that have not yet been covered in this
book.
<H3 ALIGN="CENTER"><A NAME="Heading4"></A><FONT COLOR="#000077">String</FONT></H3>
<P>The most popular library is almost certainly the string library, with perhaps
the function <TT>strlen()</TT> called most often. <TT>strlen()</TT> returns the length
of a null-terminated string. Listing 21.1 illustrates its use.</P>

<P><A NAME="Heading5"></A><FONT SIZE="4" COLOR="#000077"><B>Listing 21.1. strlen().</B></FONT>
<PRE><FONT COLOR="#0066FF">1:     #include &lt;iostream.h&gt;
2:     #include &lt;string.h&gt;
3:
4:     int main()
5:     {
6:        char buffer80];
7:        do
8:        {
9:           cout &lt;&lt; &quot;Enter a string up to 80 characters: &quot;;
10:          cin.getline(buffer,80);
11:          cout &lt;&lt; &quot;Your string is &quot; &lt;&lt; strlen(buffer);
12:          cout &lt;&lt; &quot; characters long.&quot; &lt;&lt; endl;
13:       }    while (strlen(buffer));
14:       cout &lt;&lt; &quot;\nDone.&quot; &lt;&lt; endl;
15:     return 0;
<TT>16: }</TT></FONT>
<FONT COLOR="#0066FF">
Output: Enter a string up to 80 characters: This sentence has 31 characters
Your string is 31 characters long.
Enter a string up to 80 characters: This sentence no verb
Your string is 21 characters long.
Enter a string up to 80 characters:
Your string is 0 characters long.

Done.
</FONT></PRE>
<P><FONT COLOR="#000077"><B>Analysis: </B></FONT>On line 6, a character buffer is
created, and on line 9 the user is prompted to enter a string. As long as the user
enters a string, the length of the string is reported on line 11.<BR>
<BR>
Note the test in the <TT>do...while()</TT> statement: <TT>while (strlen(buffer))</TT>.
Since <TT>strlen()</TT> will return <TT>0</TT> when the buffer is empty, and since
<TT>0</TT> evaluates <TT>FALSE</TT>, this <TT>while</TT> loop will continue as long
as there are any characters in the buffer.
<H4 ALIGN="CENTER"><A NAME="Heading6"></A><FONT COLOR="#000077">strcpy() and strncpy()</FONT></H4>
<P>The second most popular function in <TT>string.h</TT> probably was <TT>strcpy()</TT>,
which copied one string to another. This may now be diminished somewhat as C-style
null-terminated strings have become less important in C++; typically, string manipulation
is done from within a vendor-supplied or user-written <TT>string</TT> class. Nonetheless,
your <TT>string</TT> class must support an assignment operator and a copy constructor,
and often these are implemented using <TT>strcpy()</TT>, as illustrated in Listing
21.2.</P>

<P><A NAME="Heading7"></A><FONT SIZE="4" COLOR="#000077"><B>Listing 21.2. Using strcpy.</B></FONT>
<PRE><FONT COLOR="#0066FF">1:     #include &lt;iostream.h&gt;
2:     #include &lt;string.h&gt;
3:
4:     int main()
5:     {
6:        char stringOne80];
7:        char stringTwo80];
8:
9:        stringOne0]='\0';
10:       stringTwo0]='\0';
11:
12:       cout &lt;&lt; &quot;String One: &quot; &lt;&lt; stringOne &lt;&lt; endl;
13:       cout &lt;&lt; &quot;String Two: &quot; &lt;&lt; stringTwo &lt;&lt; endl;
14:
15:       cout &lt;&lt; &quot;Enter a string: &quot;;
16:       cin.getline(stringOne,80);
17:
18:       cout &lt;&lt; &quot;\nString One: &quot; &lt;&lt; stringOne &lt;&lt; endl;
19:       cout &lt;&lt; &quot;String Two: &quot; &lt;&lt; stringTwo &lt;&lt; endl;
20:
21:       cout &lt;&lt; &quot;copying...&quot; &lt;&lt; endl;
22:       strcpy(stringTwo,stringOne);
23:
24:       cout &lt;&lt; &quot;\nString One: &quot; &lt;&lt; stringOne &lt;&lt; endl;
25:       cout &lt;&lt; &quot;String Two: &quot; &lt;&lt; stringTwo &lt;&lt; endl;
26:       cout &lt;&lt; &quot;\nDone &quot; &lt;&lt; endl;
27:     return 0;
<TT>28: }</TT></FONT>
<FONT COLOR="#0066FF">
Output: String One:
String Two:
Enter a string: Test of strcpy()

String One:  Test of strcpy()
String Two:
copying...

String One:  Test of strcpy()
String Two:  Test of strcpy()

Done</FONT></PRE>
<P><FONT COLOR="#000077"><B>Analysis: </B></FONT>Two C-style null-terminated strings
are declared on lines 6 and 7. They are initialized to empty on lines 9 and 10, and
their values are printed on lines 12 and 13. The user is prompted to enter a string,
and the result is put in <TT>stringOne</TT>; the two strings are printed again, and
only <TT>stringOne</TT> has the input. <TT>Strcpy()</TT> is then called, and <TT>stringOne</TT>
is copied into <TT>stringTwo</TT>.<BR>
<BR>
Note that the syntax of <TT>strcpy()</TT> can be read as &quot;copy into the first
parameter the string in the second parameter.&quot; What happens if the target string
(<TT>stringTwo</TT>) is too small to hold the copied string? This problem and its
solution are illustrated in Listing 21.3.</P>

<P><A NAME="Heading8"></A><FONT SIZE="4" COLOR="#000077"><B>Listing 21.3. Using strncpy().</B></FONT>
<PRE><FONT COLOR="#0066FF">1:     #include &lt;iostream.h&gt;
2:     #include &lt;string.h&gt;
3:
4:     int main()
5:     {
6:        char stringOne[80];
7:        char stringTwo[10];
8:        char stringThree[80];
9:
10:       stringOne[0]='\0';
11:       stringTwo[0]='\0';
12:       stringThree[0]='\0';
13:
14:       cout &lt;&lt; &quot;String One: &quot; &lt;&lt; stringOne &lt;&lt; endl;
15:       cout &lt;&lt; &quot;String Two: &quot; &lt;&lt; stringTwo &lt;&lt; endl;
16:       cout &lt;&lt; &quot;String Three: &quot; &lt;&lt; stringThree &lt;&lt; endl;
17:
18:       cout &lt;&lt; &quot;Enter a long string: &quot;;
19:       cin.getline(stringOne,80);
20:       strcpy(stringThree,stringOne);
21:      //   strcpy(stringTwo,stringOne);
22:
23:       cout &lt;&lt; &quot;\nString One: &quot; &lt;&lt; stringOne &lt;&lt; endl;
24:       cout &lt;&lt; &quot;String Two: &quot; &lt;&lt; stringTwo &lt;&lt; endl;
25:       cout &lt;&lt; &quot;String Three: &quot; &lt;&lt; stringThree &lt;&lt; endl;
26:
27:       strncpy(stringTwo,stringOne,9);
28:
29:       cout &lt;&lt; &quot;\nString One: &quot; &lt;&lt; stringOne &lt;&lt; endl;
30:       cout &lt;&lt; &quot;String Two: &quot; &lt;&lt; stringTwo &lt;&lt; endl;
31:       cout &lt;&lt; &quot;String Three: &quot; &lt;&lt; stringThree &lt;&lt; endl;
32:
33:       stringTwo[9]='\0';
34:
35:       cout &lt;&lt; &quot;\nString One: &quot; &lt;&lt; stringOne &lt;&lt; endl;
36:       cout &lt;&lt; &quot;String Two: &quot; &lt;&lt; stringTwo &lt;&lt; endl;
37:       cout &lt;&lt; &quot;String Three: &quot; &lt;&lt; stringThree &lt;&lt; endl;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久国产老人久久综合| 在线视频欧美精品| 亚洲第一福利一区| 亚洲电影一级黄| 亚洲精品免费在线观看| 亚洲曰韩产成在线| 婷婷一区二区三区| 人人狠狠综合久久亚洲| 精品在线播放免费| 国产精品一区免费在线观看| 成人免费电影视频| 色婷婷久久久亚洲一区二区三区| 91黄色免费看| 欧美变态口味重另类| 亚洲国产精品精华液2区45| 国产精品乱码久久久久久| 一区二区三区四区高清精品免费观看| 亚洲美女电影在线| 蜜臀av性久久久久蜜臀aⅴ流畅| 亚洲成av人片| 国产成人在线视频播放| 日本精品裸体写真集在线观看| 欧美乱熟臀69xxxxxx| 久久蜜桃一区二区| 一区二区三区中文在线观看| 国产精品一区免费视频| 99久久国产综合精品女不卡| 欧美在线免费视屏| 日韩精品一区二区三区swag | 99在线精品视频| 在线区一区二视频| 日韩欧美一区在线观看| 中文字幕一区二区三区视频| 午夜精品久久久久久久久久 | 在线观看精品一区| 2020国产精品自拍| 亚洲一区二区三区精品在线| 韩国午夜理伦三级不卡影院| 色诱亚洲精品久久久久久| 日韩精品一区二区三区蜜臀| 亚洲欧美电影院| 韩国av一区二区三区四区| 欧美亚洲国产一区二区三区va| 久久综合九色综合97婷婷| 亚洲成a人片在线不卡一二三区| 国产乱码字幕精品高清av| 欧美剧情电影在线观看完整版免费励志电影 | 欧美电视剧免费观看| 亚洲精品五月天| 国产一区二区导航在线播放| 欧美日韩三级视频| 亚洲人xxxx| 成人午夜在线视频| 久久尤物电影视频在线观看| 日韩高清不卡一区二区三区| 色综合久久天天| 亚洲丝袜制服诱惑| 国产乱子伦视频一区二区三区 | 亚洲高清久久久| www.欧美日韩国产在线| 久久久久久久久久久黄色| 久久成人精品无人区| 欧美一区二区在线观看| 亚洲午夜视频在线观看| 成人av网址在线| 欧美国产精品中文字幕| 国产成人自拍网| 久久亚区不卡日本| 国产一区二区在线观看视频| 精品成人在线观看| 国产在线视频一区二区| 精品国产麻豆免费人成网站| 看片的网站亚洲| 欧美成人bangbros| 六月婷婷色综合| 精品成人佐山爱一区二区| 国产在线看一区| 中文字幕免费一区| 91污在线观看| 亚洲主播在线观看| 5858s免费视频成人| 蜜臀精品久久久久久蜜臀| 日韩精品一区二区三区四区 | 色综合中文字幕| 亚洲精品一二三四区| 欧美日韩亚洲综合在线 | 久久久91精品国产一区二区精品| 麻豆国产欧美一区二区三区| 久久伊人中文字幕| fc2成人免费人成在线观看播放 | 久久国产精品99久久久久久老狼 | 欧美一级一区二区| 国产伦精品一区二区三区免费 | 风流少妇一区二区| 一区二区三区四区在线播放 | 日韩av在线播放中文字幕| 精品成人免费观看| 91丨九色丨蝌蚪富婆spa| 婷婷成人激情在线网| 亚洲精品在线网站| 91蜜桃网址入口| 蜜桃av噜噜一区| 中文字幕亚洲一区二区av在线| 色婷婷综合久久久久中文一区二区 | 欧美日韩国产小视频| 久草中文综合在线| 亚洲天堂av老司机| 日韩精品资源二区在线| www.视频一区| 老司机精品视频导航| 亚洲视频一区二区在线观看| 91精品在线一区二区| 丁香啪啪综合成人亚洲小说 | 国产亚洲精品资源在线26u| 99久久亚洲一区二区三区青草 | 成人亚洲一区二区一| 午夜精品久久久久久久99水蜜桃| 久久久亚洲国产美女国产盗摄| 欧洲精品视频在线观看| 国产精品综合久久| 日韩有码一区二区三区| 国产精品灌醉下药二区| 精品久久久久久亚洲综合网 | 国产91精品在线观看| 天天亚洲美女在线视频| 综合色中文字幕| 久久丝袜美腿综合| 在线不卡一区二区| 色香蕉久久蜜桃| 粉嫩av亚洲一区二区图片| 日韩二区三区在线观看| 夜色激情一区二区| 欧美国产成人精品| 久久久噜噜噜久噜久久综合| 欧美电影在哪看比较好| 在线观看日韩国产| 日本福利一区二区| 波多野洁衣一区| 丁香亚洲综合激情啪啪综合| 激情文学综合网| 精品一区二区三区的国产在线播放 | 一区二区三区四区在线| 国产精品第五页| 国产精品沙发午睡系列990531| 2017欧美狠狠色| 精品成a人在线观看| 欧美大肚乱孕交hd孕妇| 日韩一区二区在线播放| 日韩欧美www| 精品国产髙清在线看国产毛片| 欧美一区二区在线视频| 日韩三级免费观看| 精品国产一区二区亚洲人成毛片| 91精品国产综合久久久久| 91精品国产综合久久精品性色| 欧美日韩dvd在线观看| 欧美日本韩国一区| 欧美一级片在线观看| 欧美成人猛片aaaaaaa| 精品国产一二三区| 中文av字幕一区| 中文字幕一区二区三中文字幕| 国产精品久久久久久久久久免费看 | 91视频一区二区三区| 一本到一区二区三区| 欧美日韩精品电影| 精品噜噜噜噜久久久久久久久试看| 精品欧美一区二区三区精品久久| 2021国产精品久久精品| 国产精品人妖ts系列视频| 一区二区成人在线视频| 水野朝阳av一区二区三区| 狠狠色伊人亚洲综合成人| 成人国产电影网| 欧美三级蜜桃2在线观看| 精品国产乱码久久久久久浪潮| 国产精品美女久久久久久| 一个色妞综合视频在线观看| 蜜桃av一区二区| 9i看片成人免费高清| 欧美久久一区二区| 国产精品视频线看| 午夜欧美电影在线观看| 国产成人av电影在线观看| 色呦呦日韩精品| 久久无码av三级| 一区二区三区在线观看欧美| 日本aⅴ免费视频一区二区三区| 粉嫩高潮美女一区二区三区| 欧美日本精品一区二区三区| 久久精品在线观看| 国v精品久久久网| 欧美在线观看禁18| 国产欧美日韩在线观看| 午夜精品福利一区二区三区av| 高潮精品一区videoshd| 337p亚洲精品色噜噜噜| 亚洲精品高清在线观看| 国产宾馆实践打屁股91| 欧美日韩你懂的|