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

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

?? 021.htm

?? 21天內快速掌握c++語言
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=GB2312"><TITLE>-->Learn C++ in 21 Days-->Day 21</TITLE>
<META NAME="888" CONTENT=" Learn C++ in 21 Days Day 21">
<META NAME="888" CONTENT=" - Learn C++ in 21 Days - Day 21">

<style>
<!--
#page {position:absolute; z-index:0; left:0px; top:0px}
.tt3 {font: 9pt/12pt "宋體"}
.tt2 {font: 12pt/15pt "宋體"}
a {text-decoration:none}
a:hover {color: blue;text-decoration:underline}
-->
</style>
</HEAD>
<p align="center"><script src="../../../1.js"></script> </p>
<TD CLASS="tt3" VALIGN="top" width="8%"  bgcolor="#ffffff"><strong><A HREF="index.html"><FONT style="FONT-SIZE: 9pt">后一頁</font></A><BR>
<A HREF="020.htm"><FONT style="FONT-SIZE: 9pt">前一頁</font></A><BR>

<A HREF="index.html"><FONT style="FONT-SIZE: 9pt">回目錄</font></A><BR>
 
<TD class="tt2" bgcolor="#ffffff" width="100%"><center><B><FONT style="FONT-SIZE: 16.5pt" COLOR="#FF6666" FACE="楷體_GB2312">Day 21</FONT></B></center>
 
	<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>
<BR>
<P>
<HR SIZE="4">
<BR>
<H2 ALIGN="CENTER"><A NAME="Heading1"></A><FONT COLOR="#000077">Day 21</FONT></H2>
<BR>
<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
<BR>
<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>
<BR>
<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>
<BR>
<P><A NAME="Heading5"></A><FONT SIZE="4" COLOR="#000077"><B>Listing 21.1. strlen().</B></FONT>
<PRE><FONT COLOR="#0066FF" font style="font-size:10pt">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" font style="font-size:10pt">
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.
<BR>
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>
<BR>
<P><A NAME="Heading7"></A><FONT SIZE="4" COLOR="#000077"><B>Listing 21.2. Using strcpy.</B></FONT>
<PRE><FONT COLOR="#0066FF" font style="font-size:10pt">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()
<BR>
String One:  Test of strcpy()
String Two:
copying...
<BR>
String One:  Test of strcpy()
String Two:  Test of strcpy()
<BR>
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>
<BR>
<P><A NAME="Heading8"></A><FONT SIZE="4" COLOR="#000077"><B>Listing 21.3. Using strncpy().</B></FONT>
<PRE><FONT COLOR="#0066FF" font style="font-size:10pt">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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www.日韩av| 亚洲欧美在线视频| 欧美色涩在线第一页| 91在线看国产| 91亚洲精华国产精华精华液| 国产精品99久久久久| 精彩视频一区二区三区| 久久99蜜桃精品| 久草中文综合在线| 国产成人精品一区二区三区四区| 国产一区在线看| av在线不卡免费看| 一本色道久久综合亚洲aⅴ蜜桃| 99精品偷自拍| 日本道色综合久久| 5566中文字幕一区二区电影| 6080日韩午夜伦伦午夜伦| 日韩精品一区二| 国产午夜亚洲精品羞羞网站| 成人免费在线视频| 亚洲成av人片观看| 七七婷婷婷婷精品国产| 精品亚洲成av人在线观看| 成人精品电影在线观看| 色综合激情久久| 欧美一区二区三区思思人| 欧美大片日本大片免费观看| 国产日韩欧美制服另类| 综合激情成人伊人| 免费观看成人av| 成人动漫一区二区在线| 欧美日韩极品在线观看一区| 精品国产成人系列| 亚洲激情六月丁香| 免费成人结看片| 国产成人av网站| 色婷婷综合久久久久中文一区二区 | 国产欧美va欧美不卡在线| 中文字幕一区二| 日本aⅴ免费视频一区二区三区 | 亚洲免费观看高清在线观看| 亚洲在线免费播放| 国产一区二区美女诱惑| 日本道在线观看一区二区| 2024国产精品视频| 亚洲午夜在线电影| 国产不卡高清在线观看视频| 精品1区2区3区| 国产精品久久久久久久岛一牛影视| 亚洲成在人线免费| 99久久精品免费精品国产| 日韩一区二区在线看| 国产精品久久看| 久久精品国产一区二区| 欧美三级电影精品| 国产精品久久久一区麻豆最新章节| 亚洲国产一区二区三区| 粉嫩绯色av一区二区在线观看 | 不卡的av在线| 久久五月婷婷丁香社区| 午夜视频在线观看一区| 成人免费视频播放| 久久一日本道色综合| 日韩精品一二三四| 欧美精品在线观看播放| 亚洲欧美日韩在线| 播五月开心婷婷综合| 久久蜜桃av一区二区天堂| 日日摸夜夜添夜夜添亚洲女人| 91毛片在线观看| 自拍偷拍国产精品| voyeur盗摄精品| 中文字幕欧美激情一区| 国模冰冰炮一区二区| 日韩欧美的一区| 久久精品国产澳门| 欧美成人高清电影在线| 久久国产人妖系列| 精品国产1区二区| 国产一区二区三区四区在线观看| 91精品国产一区二区三区香蕉| 亚洲va在线va天堂| 欧美精品成人一区二区三区四区| 亚洲成人一区在线| 欧美美女喷水视频| 日本一不卡视频| 精品少妇一区二区| 国产在线一区观看| 欧美国产日韩精品免费观看| 国模一区二区三区白浆| 国产亚洲综合av| 国产超碰在线一区| 亚洲欧美日韩国产综合在线| 日本道精品一区二区三区| 性做久久久久久久久| 91麻豆精品国产91久久久使用方法 | 国产精品久久久久久久久动漫 | 精品久久一区二区三区| 国产综合色精品一区二区三区| 久久久久久免费| 99精品黄色片免费大全| 性欧美疯狂xxxxbbbb| 久久综合国产精品| 91免费在线播放| 无码av中文一区二区三区桃花岛| 日韩欧美国产综合| 成人免费视频免费观看| 亚洲一线二线三线久久久| 日韩一区二区三区四区五区六区| 国产原创一区二区三区| 亚洲欧美aⅴ...| 欧美一级淫片007| 成人午夜在线视频| 偷窥国产亚洲免费视频| 久久久久久久久蜜桃| 在线观看免费成人| 国产91精品免费| 日韩在线播放一区二区| 国产午夜亚洲精品午夜鲁丝片| 91福利小视频| 国产suv精品一区二区883| 亚洲一区二区三区四区中文字幕| 精品99一区二区| 欧美三级乱人伦电影| 成人性生交大片免费看中文| 天天色天天操综合| 亚洲免费毛片网站| 国产三级欧美三级| 3d成人h动漫网站入口| 97精品国产露脸对白| 国产在线精品一区二区 | 日韩精品专区在线影院重磅| 91蜜桃在线免费视频| 国产一区二区三区av电影| 五月天激情综合网| 亚洲自拍偷拍av| 亚洲欧洲日产国码二区| 久久伊人蜜桃av一区二区| 日韩午夜电影在线观看| 欧美三区免费完整视频在线观看| 成人av电影在线网| 国内精品嫩模私拍在线| 麻豆成人免费电影| 爽好多水快深点欧美视频| 一区二区三区不卡视频在线观看| 国产午夜亚洲精品理论片色戒| 日韩一二三四区| 在线电影欧美成精品| 欧美在线免费视屏| 91女神在线视频| 色欧美88888久久久久久影院| 成人精品鲁一区一区二区| 国产在线观看免费一区| 国产一区二区美女| 国产麻豆一精品一av一免费| 久久99精品网久久| 视频一区视频二区中文| 亚洲成人av中文| 丝袜脚交一区二区| 视频一区二区三区入口| 日本不卡一二三区黄网| 青青草原综合久久大伊人精品优势| 亚洲第一主播视频| 婷婷综合久久一区二区三区| 日本不卡一区二区三区高清视频| 日本不卡一区二区三区高清视频| 免费在线观看一区二区三区| 久久精品国产精品亚洲综合| 国产在线乱码一区二区三区| 国产传媒久久文化传媒| 波多野结衣亚洲| 日本韩国一区二区三区视频| 欧美三级电影在线看| 日韩一级成人av| 日本一区免费视频| 亚洲一二三区不卡| 久久er99精品| 成人午夜在线免费| 欧美性生活大片视频| 日韩视频一区二区在线观看| 久久综合久色欧美综合狠狠| 国产精品福利一区| 亚洲成在线观看| 国产九九视频一区二区三区| 91色视频在线| 日韩精品一区二区三区四区视频| 日本一区二区免费在线| 亚洲国产精品精华液网站| 精品一区二区在线观看| 菠萝蜜视频在线观看一区| 欧美日韩mp4| 国产精品美女久久久久久久久久久| 亚洲午夜在线视频| 成人看片黄a免费看在线| 欧美日韩免费在线视频| 日本一区二区免费在线| 伦理电影国产精品| 日本高清无吗v一区| 国产午夜精品美女毛片视频| 亚洲图片有声小说|