资源简介
Essential C++源代码,包括书内每章节案例源码及练习题答案源码。目录结构清晰,便于学习。附pdf版《Essential C++》
代码片段和文件信息
/**************************************************
* 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\n“;
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!\n“;
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!\n“
<< “In any case\n“;
// no break -- we fall through ...
default:
// the 127 case drops through to here -- no break
cout << “Hello “ << user_name
<< “ -- happy to make your acquaintance!\n“;
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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-25 08:55 essential cpp源码\
目录 0 2018-04-25 09:17 essential cpp源码\Essential C++\
文件 14865229 2008-12-01 10:38 essential cpp源码\Essential C++\Essential.cpp.cn.pdf
目录 0 2018-04-25 09:17 essential cpp源码\Essential C++\codeEssential\
文件 366333 1999-12-07 13:25 essential cpp源码\Essential C++\codeEssential\Appendix.pdf
目录 0 1999-07-21 12:19 essential cpp源码\Essential C++\codeEssential\chapter1\
目录 0 2018-04-25 09:17 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\
文件 4471 1999-12-07 08:06 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\ch1solutions.dsp
文件 547 1999-12-07 01:04 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\ch1solutions.dsw
文件 41984 1999-12-07 13:04 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\ch1solutions.ncb
文件 54784 1999-12-07 13:04 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\ch1solutions.opt
文件 5157 1999-12-07 12:58 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\ch1solutions.plg
文件 371 1999-12-07 13:01 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\input.txt
文件 368 1999-12-07 13:04 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\input.txt.sort
文件 5970 1999-12-07 13:13 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\main.cpp
文件 124 1999-12-07 01:09 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\text.sort
文件 114 1999-12-07 12:59 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\text.txt
文件 112 1999-12-07 13:02 essential cpp源码\Essential C++\codeEssential\chapter1\ch1solutions\text.txt.sort
目录 0 2018-04-25 09:17 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\
目录 0 2018-04-25 09:17 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\
文件 326582 2009-04-21 19:15 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\ch1.obj
文件 22013 2009-04-21 19:15 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\ch1_main.obj
文件 573526 2009-04-21 19:15 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\chap1.exe
文件 814880 2009-04-21 19:15 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\chap1.ilk
文件 2064228 2009-04-21 19:15 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\chap1.pch
文件 1131520 2009-04-21 19:15 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\chap1.pdb
文件 82944 2009-04-21 19:20 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\vc60.idb
文件 126976 2009-04-21 19:15 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\Debug\vc60.pdb
文件 7943 1999-12-07 13:13 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\ch1.cpp
文件 3344 1999-12-07 13:14 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\ch1.h
文件 491 1999-12-07 13:14 essential cpp源码\Essential C++\codeEssential\chapter1\chap1\ch1_main.cpp
............此处省略160个文件信息
相关资源
- DX11,DX图形设计游戏跳一跳C++实现.
- The C++ Programming Language中文版
- 海康 最新的 sdk demo c++
- 数据结构与程序设计C++语言描述(中
- C++网络编程(卷I和卷II高清扫描版)
- A Tour of C++ (2nd Edition)
- C++读取Excel源代码
- 完整串口通信程序Vc++源代码
- 组态软件设计与开发PDF+源代码
- 清华 数据结构(C++语言版)第三版
- 明日科技C++从入门到精通(第3版)随
- C++入门经典.
- VC++6.0_win10兼容_番茄助手
- Ymodem协议 完整MFC工程C++实现
- QT5 GUI C++编程Cookbook()
- 数据结构C++版邓俊辉 第三版 带习题
- vc++-MFC画圆
- C++程序设计语言经典书籍C++圣经
- 传智播客旗下黑马程序员c++视频课程
- c++调用webservice(包括静态和动态以及
- Effective C++中文第三版和More Effective
- Windows下libevent C++封装类实现
- vc++ 五子棋
- 匠心精作C++从0到1入门编程-学习编程
- C++ GUI Qt4编程第二版电子书pdf
- C++学院讲义
- dll动态链接库和c++依赖库缺失修复工
- 缪淮扣 沈俊 数据结构 C++实现 第2版
- 北大C++课件
- Visual C++2013入门经典源码及习题答案
评论
共有 条评论