09 2014 档案

摘要:线程、进程和多线程是面试过程中很容易遇到的问题,去年百度三面的时候就遇到这个问题,当时百度hr问到:线程和进程的区别是什么?你写过多进程或者多线程的程序吗?在你看来多线程和多进程程序那种程序比较难写?第一个问题很常规,但是要完全答对却不是那么容易,现在想来,第二个问题和第三个问题实际是一个问题,因为... 阅读全文
posted @ 2014-09-25 11:30 Jessica程序猿 阅读(10406) 评论(2) 推荐(1)
摘要:When I try runningCode::Blocks, I get the following error message:Another program instance is already running. Code::Blocks is currently configured to... 阅读全文
posted @ 2014-09-13 10:25 Jessica程序猿 阅读(5380) 评论(0) 推荐(0)
摘要:静态库 (扩展名为 .a或 .lib) 是包含函数的文件,用于在link阶段整合执行程序,动态链接库(扩展名 .dll)是不在link阶段整合进执行程序中的。DLL文件在执行阶段动态调用下面我们将用免费的开发工具CodeBocks开发静态库创建静态库启动Codeblocks并创建一个类型为 "Sta... 阅读全文
posted @ 2014-09-10 11:14 Jessica程序猿 阅读(4721) 评论(1) 推荐(0)
摘要:前言:我想大家学习C语言接触过的第一个函数应该是printf,但是我们真正理解它了吗?最近看Linux以及网络编程这块,我觉得I/O这块很难理解。以前从来没认识到Unix I/O和C标准库I/O函数压根不是一码事。Unix I/O也叫低级I/O,也叫Unbuffered I/O,是操作系统内核部分,... 阅读全文
posted @ 2014-09-08 18:47 Jessica程序猿 阅读(550) 评论(0) 推荐(0)
摘要:3.1 当读/写磁盘文件时,本章中描述的函数是否具有缓冲机制?请说明原因。3.1 所有的磁盘 I/O 都要经过内核的块缓冲区(也称为内核的缓冲区高速缓存),唯一例 外的是对原始磁盘设备的 I/O,但是我们不考虑这种情况。Bach[1986]的第 3 章描述 了这种缓冲区高速缓存的操作。既... 阅读全文
posted @ 2014-09-05 22:58 Jessica程序猿 阅读(925) 评论(0) 推荐(0)
摘要:19.18编写一个函数,使用count_if统计在给定的vector中有多少个空string。#include#include#include#include#includeusing namespace std;int main(){ vector svec={"fhhd","fdf",""... 阅读全文
posted @ 2014-09-04 21:53 Jessica程序猿 阅读(352) 评论(0) 推荐(0)
摘要:17.39#include#include#include#includeusing namespace std;int main(){ fstream inOut("copyOut",fstream::ate|fstream::in|fstream::out); if(!inOut) ... 阅读全文
posted @ 2014-09-03 18:13 Jessica程序猿 阅读(321) 评论(0) 推荐(0)
摘要:#include#include#includeusing namespace std;int main(){ ifstream file("1.txt"); char ch[20]; cout<<"getline: "<<endl; while(file.getline(c... 阅读全文
posted @ 2014-09-03 17:49 Jessica程序猿 阅读(525) 评论(0) 推荐(0)
摘要:#include#include#includeusing namespace std;int main(){ cout>noskipws; while(cin>>ch) cout>skipws;} 阅读全文
posted @ 2014-09-03 15:55 Jessica程序猿 阅读(270) 评论(0) 推荐(0)
摘要:17.28 编写函数,每次调用生成并返回一个均匀分布的随机unsigned int。 ... 阅读全文
posted @ 2014-09-03 11:34 Jessica程序猿 阅读(210) 评论(0) 推荐(0)
摘要:17.10使用序列1、2、3、5、8、13、21初始化一个bitset,将这些位置置位。对另一个bitset进行默认初始化,并编写一小段程序将其恰当的位置位。#include#includeusing namespace std;int main(){ bitset bits("1000000... 阅读全文
posted @ 2014-09-02 22:25 Jessica程序猿 阅读(215) 评论(0) 推荐(0)
摘要:17.4编写并测试findbook函数#include#include#include#include#include#include"Sales_data.h"using namespace std;typedef tuple::size_type,vector::const_iterator,v... 阅读全文
posted @ 2014-09-02 20:41 Jessica程序猿 阅读(835) 评论(0) 推荐(0)
摘要:17.3 重写前面的TextQuery程序,使用tuple代替QueryResult类。TextQuery.h#ifndef TEXTQUERY_H#define TEXTQUERY_H#include#include#include#include#include#include#include#... 阅读全文
posted @ 2014-09-02 19:08 Jessica程序猿 阅读(401) 评论(0) 推荐(0)
摘要:16.62定义你自己版本的hash,并定义一个Sales_data对象的unordered_multiset。将多条交易记录保存到容器中,并打印其内容。Sales_data.h#ifndef SALES_DATA_H#define SALES_DATA_H#include#includeusing ... 阅读全文
posted @ 2014-09-02 15:40 Jessica程序猿 阅读(695) 评论(0) 推荐(0)
摘要:16.58 为你的StrVec类添加emplace_back函数。StrVec.h(注意,函数模板和模板成员函数的定义和声明要放在一起,通常都放在头文件中)#ifndef STRVEC_H#define STRVEC_H#include#include#include#include#include... 阅读全文
posted @ 2014-09-02 10:23 Jessica程序猿 阅读(388) 评论(0) 推荐(0)
摘要:16.53 编写你自己版本的print函数,并打印一个、两个及五个实参来测试它,要打印的每个实参都应有不同的类型。#include#includeusing namespace std;template ostream& print(ostream &os,const T &t){ osost... 阅读全文
posted @ 2014-09-01 22:59 Jessica程序猿 阅读(200) 评论(0) 推荐(0)
摘要:16.47 编写你自己版本的翻转函数,通过调用接受左值和右值引用参数的函数来测试它。#include#include#includeusing namespace std;template int compare(const T &a ,const T &b){ if(aauto sum(T ... 阅读全文
posted @ 2014-09-01 20:49 Jessica程序猿 阅读(244) 评论(0) 推荐(0)
摘要:16.21 编写你自己的DebugDelete版本。#include#includeusing namespace std;class DebugDelete{public: DebugDelete(ostream &s=cerr):os(s) {} template void ... 阅读全文
posted @ 2014-09-01 10:37 Jessica程序猿 阅读(254) 评论(0) 推荐(0)