由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 大家来讨论一下c++吧
相关主题
帮我看看这两个题目回答大家谈谈看???
C++ template Questions一道A家店面题求解
ANY IDEA?static initialization dependency c++ (转载)
written test from Interactive Brokers请教一个C++问题
问一道C++ template的面试题一道STL面试题
C++ online Test 一题C++问题
请教一个IT题目今早google电面报告
新鲜 interveiw questionsC++ Singleton Template - 编译通不过
相关话题的讨论汇总
话题: reduce话题: function话题: container话题: c++话题: typename
进入JobHunting版参与讨论
1 (共1页)
i***0
发帖数: 8469
1
大家来讨论一下c++吧
Please answer the following c++ questions. Do not simply answer yes/no.
Always explain your assumptions and reasoning.
1. memset is sometimes used to initialize data in a constructor like the
example below. What is the benefit of initializing this way? Does it work
in this example? Does it work in general ? Is it a good idea in general?
class A {
public:
A();
private:
int a;
float f;
char str[35];
long *lp;
};
A::A()
{
memset(this, 0, sizeof(*this));
}
2. Your task is to implement the Reduce function using templates. The
Reduce fn applies a function of two arguments cumulatively to the items of
an STL container, from begin() to end(), so as to reduce the sequence to a
single value. For example, Reduce(, std::plus >()) should calculate ((((1+2)+3)+4)+5).
class NotEnoughElements {};
template
typename Container::value_type
Reduce(const Container& c, Function fn) throw (NotEnoughElements)
{
FILL OUT
}
3. Write a C++ program that would find and print the first longest
ascending or descending contiguous subsequence for a vector of integers. For
example, given a vector with
4, 2, 1, 2, 3, 4, 3, 5, 1, 2, 4, 6, 5
the program would find the underlined subsequence and print it.
4. You have a class that many libraries depend on. Now you need to modify
the class for one application. Which of the following changes require
recompiling all libraries before it is safe to build the application?
a. add a constructor
b. add a data member
c. change destructor into virtual
d. add an argument with default value to an existing member function
1 (共1页)
进入JobHunting版参与讨论
相关主题
C++ Singleton Template - 编译通不过问一道C++ template的面试题
C++在vector里找>50的数,怎么找?C++ online Test 一题
问个简单的C++ 函数参数问题请教一个IT题目
问个C++模板定义的问题新鲜 interveiw questions
帮我看看这两个题目回答大家谈谈看???
C++ template Questions一道A家店面题求解
ANY IDEA?static initialization dependency c++ (转载)
written test from Interactive Brokers请教一个C++问题
相关话题的讨论汇总
话题: reduce话题: function话题: container话题: c++话题: typename