Essential c++ 高清pdf+随书源码
Essential c++ 高清pdf+随书源码
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 366333 1999-12-07 13:25 codeEssentialAppendix.pdf
文件 4471 1999-12-07 08:06 codeEssentialchapter1ch1solutionsch1solutions.dsp
文件 547 1999-12-07 01:04 codeEssentialchapter1ch1solutionsch1solutions.dsw
文件 41984 1999-12-07 13:04 codeEssentialchapter1ch1solutionsch1solutions.ncb
文件 54784 1999-12-07 13:04 codeEssentialchapter1ch1solutionsch1solutions.opt
文件 5157 1999-12-07 12:58 codeEssentialchapter1ch1solutionsch1solutions.plg
文件 371 1999-12-07 13:01 codeEssentialchapter1ch1solutionsinput.txt
文件 368 1999-12-07 13:04 codeEssentialchapter1ch1solutionsinput.txt.sort
文件 5970 1999-12-07 13:13 codeEssentialchapter1ch1solutionsmain.cpp
文件 124 1999-12-07 01:09 codeEssentialchapter1ch1solutions ext.sort
文件 114 1999-12-07 12:59 codeEssentialchapter1ch1solutions ext.txt
文件 112 1999-12-07 13:02 codeEssentialchapter1ch1solutions ext.txt.sort
文件 7943 1999-12-07 13:13 codeEssentialchapter1chap1ch1.cpp
文件 3344 1999-12-07 13:14 codeEssentialchapter1chap1ch1.h
文件 491 1999-12-07 13:14 codeEssentialchapter1chap1ch1_main.cpp
文件 4393 1999-12-06 08:18 codeEssentialchapter1chap1chap1.dsp
文件 533 1999-12-06 08:14 codeEssentialchapter1chap1chap1.dsw
文件 33792 1999-12-06 08:18 codeEssentialchapter1chap1chap1.ncb
文件 53760 1999-12-06 08:18 codeEssentialchapter1chap1chap1.opt
文件 1282 1999-12-06 08:16 codeEssentialchapter1chap1chap1.plg
文件 6359 2017-02-23 14:42 codeEssentialchapter1chap1chap1.vcxproj
文件 1113 2017-02-23 14:42 codeEssentialchapter1chap1chap1.vcxproj.filters
文件 6905 1999-12-07 13:15 codeEssentialchapter2ch2solutionsch2main.cpp
文件 3460 1999-12-07 08:06 codeEssentialchapter2ch2solutionsch2solutions.dsp
文件 547 1999-12-07 08:06 codeEssentialchapter2ch2solutionsch2solutions.dsw
文件 33792 1999-12-07 08:09 codeEssentialchapter2ch2solutionsch2solutions.ncb
文件 53760 1999-12-07 08:09 codeEssentialchapter2ch2solutionsch2solutions.opt
文件 3760 1999-12-07 08:09 codeEssentialchapter2ch2solutionsch2solutions.plg
文件 9140 1999-12-07 13:15 codeEssentialchapter2chap2c2_main.cpp
文件 4274 1999-12-06 08:37 codeEssentialchapter2chap2chap2.dsp
............此处省略126个文件信息
/**************************************************
* Essential C++ -- Stanley Lippman
* Addison-Wesley
* ISBN 0-201-48518-4
* homepage: www.objectwrite.com
* email: slippman@objectwrite.com
*************************************************/
#include
#include
using namespace std;
int ex1_5_string()
{
string user_name;
cout << “Please enter your name: “;
cin >> user_name;
switch ( user_name.size() ){
case 0:
cout << “Ah the user with no name. “
<< “Well ok hi user with no name
“;
break;
case 1:
cout << “A 1-character name? Hmm have you read Kafka?: “
<< “hello “ << user_name << endl;
break;
default:
// any string longer than 1 character
cout << “Hello “ << user_name
<< “ -- happy to make your acquaintance!
“;
break;
}
return 0;
}
#include
#include
#include
using namespace std;
int ex1_5_cstyle()
{
// must allocate a fixed size
const int nm_size = 128;
char user_name[ nm_size ];
cout << “Please enter your name: “;
cin >> setw( nm_size ) >> user_name;
switch ( strlen( user_name ))
{
// case labels the same for 0 1
case 127:
// maybe string was truncated by setw()
cout << “That is a very big name indeed -- “
<< “we may have needed to shorten it!
“
<< “In any case
“;
// no break -- we fall through ...
default:
// the 127 case drops through to here -- no break
cout << “Hello “ << user_name
<< “ -- happy to make your acquaintance!
“;
break;
}
return 0;
}
#include
#include
using namespace std;
void ex1_6_vector()
{
vector ivec;
int ival;
while ( cin >> ival )
ivec.push_back( ival );
// we could have calculated the sum as we entered the
// values but the idea is to iterate over the vector ...
int sum = 0;
for ( int ix = 0; ix < ivec.size(); ++ix )
{
cout << endl << ix << “) “ << ivec[ ix ];
sum += ivec[ ix ]; }
int average = sum / ivec.size();
cout << “Sum of “ << ivec.size()
<< “ elements: “ << sum
<< “. Average: “ << average << endl;
}
void ex1_6_array()
{
const int arr_size = 128;
int ia[ arr_size ];
int ival icnt = 0;
while ( cin >> ival && icnt < arr_size )
ia[ icnt++ ] = ival;
// icnt is 1 greater than number of elements!
int sum = 0;
for ( int ix = 0; ix < icnt; ++ix )
sum += ia[ ix ];
int average = sum / icnt;
cout << endl
<< “Sum of “ << icnt
<< “ elements: “ << sum
<< “. Average: “ << average << endl;
}
#include
#include
void ex1_xtra1()
{
vector< string* > sp_vec;
string st;
cout << “P
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 366333 1999-12-07 13:25 codeEssentialAppendix.pdf
文件 4471 1999-12-07 08:06 codeEssentialchapter1ch1solutionsch1solutions.dsp
文件 547 1999-12-07 01:04 codeEssentialchapter1ch1solutionsch1solutions.dsw
文件 41984 1999-12-07 13:04 codeEssentialchapter1ch1solutionsch1solutions.ncb
文件 54784 1999-12-07 13:04 codeEssentialchapter1ch1solutionsch1solutions.opt
文件 5157 1999-12-07 12:58 codeEssentialchapter1ch1solutionsch1solutions.plg
文件 371 1999-12-07 13:01 codeEssentialchapter1ch1solutionsinput.txt
文件 368 1999-12-07 13:04 codeEssentialchapter1ch1solutionsinput.txt.sort
文件 5970 1999-12-07 13:13 codeEssentialchapter1ch1solutionsmain.cpp
文件 124 1999-12-07 01:09 codeEssentialchapter1ch1solutions ext.sort
文件 114 1999-12-07 12:59 codeEssentialchapter1ch1solutions ext.txt
文件 112 1999-12-07 13:02 codeEssentialchapter1ch1solutions ext.txt.sort
文件 7943 1999-12-07 13:13 codeEssentialchapter1chap1ch1.cpp
文件 3344 1999-12-07 13:14 codeEssentialchapter1chap1ch1.h
文件 491 1999-12-07 13:14 codeEssentialchapter1chap1ch1_main.cpp
文件 4393 1999-12-06 08:18 codeEssentialchapter1chap1chap1.dsp
文件 533 1999-12-06 08:14 codeEssentialchapter1chap1chap1.dsw
文件 33792 1999-12-06 08:18 codeEssentialchapter1chap1chap1.ncb
文件 53760 1999-12-06 08:18 codeEssentialchapter1chap1chap1.opt
文件 1282 1999-12-06 08:16 codeEssentialchapter1chap1chap1.plg
文件 6359 2017-02-23 14:42 codeEssentialchapter1chap1chap1.vcxproj
文件 1113 2017-02-23 14:42 codeEssentialchapter1chap1chap1.vcxproj.filters
文件 6905 1999-12-07 13:15 codeEssentialchapter2ch2solutionsch2main.cpp
文件 3460 1999-12-07 08:06 codeEssentialchapter2ch2solutionsch2solutions.dsp
文件 547 1999-12-07 08:06 codeEssentialchapter2ch2solutionsch2solutions.dsw
文件 33792 1999-12-07 08:09 codeEssentialchapter2ch2solutionsch2solutions.ncb
文件 53760 1999-12-07 08:09 codeEssentialchapter2ch2solutionsch2solutions.opt
文件 3760 1999-12-07 08:09 codeEssentialchapter2ch2solutionsch2solutions.plg
文件 9140 1999-12-07 13:15 codeEssentialchapter2chap2c2_main.cpp
文件 4274 1999-12-06 08:37 codeEssentialchapter2chap2chap2.dsp
............此处省略126个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)