当前位置:文档之家› C++中vector的用法

C++中vector的用法

C++中vector的用法
C++中vector的用法

C++Vector用法

C++内置的数组支持容器的机制,但是它不支持容器抽象的语义。要解决此问题我们自己实现这样的类。在标准C++中,用容器向量(vector)实现。容器向量也是一个类模板。

标准库vector类型使用需要的头文件:#include 。vector 是一个类模板。不是一种数据类型,vector是一种数据类型。Vector的存储空间是连续的,list不是连续存储的。

一、定义和初始化

vector< typeName > v1; //默认v1为空,故下面的赋值是错误的v1[0]=5;

vectorv2(v1); 或v2=v1;或vector v2(v1.begin(), v1.end());//v2是v1的一个副本,若v1.size()>v2.size()则赋值后v2.size()被扩充为v1.size()。

vector< typeName > v3(n,i);//v3包含n个值为i的typeName类型元素

vector< typeName > v4(n); //v4含有n个值为0的元素

int a[4]={0,1,2,3,3}; vector v5(a,a+5);//v5的size为5,v5被初始化为a的5个值。后一个指针要指向将被拷贝的末元素的下一位置。

vector v6(v5);//v6是v5的拷贝

vector< 类型> 标识符(最大容量,初始所有值);

二、值初始化

1> 如果没有指定元素初始化式,标准库自行提供一个初始化值进行值初始化。

2> 如果保存的式含有构造函数的类类型的元素,标准库使用该类型的构造函数初始化。

3> 如果保存的式没有构造函数的类类型的元素,标准库产生一个带初始值的对象,使用这个对象进行值初始化。

三、vector对象最重要的几种操作

1. v.push_back(t) 在容器的最后添加一个值为t的数据,容器的size变大。

另外list有push_front()函数,在前端插入,后面的元素下标依次增大。

2. v.size() 返回容器中数据的个数,size返回相应vector类定义的size_type的值。v.resize(2*v.size)或

v.resize(2*v.size, 99) 将v的容量翻倍(并把新元素的值初始化为99)

3. v.empty() 判断vector是否为空

4. v[n] 返回v中位置为n的元素

5. v.insert(pointer,number, content) 向v中pointer指向的位置插入number个content 的内容。

还有v. insert(pointer, content),v.insert(pointer,a[2],a[4])将a[2]到a[4]三个元素插入。

6. v.pop_back() 删除容器的末元素,并不返回该元素。

7.v.erase(pointer1,pointer2) 删除pointer1到pointer2中间(包括pointer1所指)的元素。

vector中删除一个元素后,此位置以后的元素都需要往前移动一个位置,虽然当前迭代器位置没有自动加1,

但是由于后续元素的顺次前移,也就相当于迭代器的自动指向下一个位置一样。

8. v1==v2 判断v1与v2是否相等。

9. !=、<、<=、>、>= 保持这些操作符惯有含义。

10. vector::iterator p=v1.begin( ); p初始值指向v1的第一个元素。*p取所指向元素的值。

对于const vector只能用vector::const_iterator类型的指针访问。

11. p=v1.end( ); p指向v1的最后一个元素的下一位置。

12.v.clear() 删除容器中的所有元素。12.v.clear() 删除容器中的所有元素。

#include中的泛函算法

搜索算法:find() 、search() 、count() 、find_if() 、search_if() 、count_if()

分类排序:sort() 、merge()

删除算法:unique() 、remove()

生成和变异:generate() 、fill() 、transformation() 、copy()

关系算法:equal() 、min() 、max()

sort(v1.begin(),vi.begin()+v1.size/2); 对v1的前半段元素排序

list::iterator pMiddle =find(cList.begin(),cList.end(),'A');找到则返回被查内容第一次出现处指针,否则返回end()。

vector< typeName >::size_type x ; vector< typeName >类型的计数,可用于循环如同for(int i)

初学C++的程序员可能会认为vector的下标操作可以添加元素,其实不然:

vector ivec; // empty vector

for (vector::size_type ix = 0; ix != 10; ++ix)

ivec[ix] = ix; // disaster: ivec has no elements

上述程序试图在ivec中插入10个新元素,元素值依次为0到9的整数。但是,这里ivec是空的vector对象,而且下标只能用于获取已存在的元素。

这个循环的正确写法应该是:

for (vector::size_type ix = 0; ix != 10; ++ix)

ivec.push_back(ix); // ok: adds new element with value ix

警告:必须是已存在的元素才能用下标操作符进行索引。通过下标操作进行赋值时,不会添

加任何元素。仅能对确知已存在的元素进行下标操作

四、内存管理与效率

1.使用reserve()函数提前设定容量大小,避免多次容量扩充操作导致效率低下。

关于STL容器,最令人称赞的特性之一就是是只要不超过它们的最大大小,它们就可以自动增长到足以容纳你放进去的数据。(要知道这个最大值,只要调用名叫max_size 的成员函数。)对于vector和string,如果需要更多空间,就以类似realloc的思想来增长大小。vector容器支持随机访问,因此为了提高效率,它内部使用动态数组的方式实现的。在通过reserve() 来申请特定大小的时候总是按指数边界来增大其内部缓冲区。当进行insert 或push_back等增加元素的操作时,如果此时动态数组的内存不够用,就要动态的重新分配当前大小的1.5~2倍的新内存区,再把原数组的内容复制过去。所以,在一般情况下,其访问速度同一般数组,只有在重新分配发生时,其性能才会下降。正如上面的代码告诉你的那样。而进行pop_back操作时,capacity并不会因为vector容器里的元素减少而有所下降,还会维持操作之前的大小。对于vector容器来说,如果有大量的数据需要进行push_back,应当使用reserve()函数提前设定其容量大小,否则会出现许多次容量扩充操作,导致效率低下。

reserve成员函数允许你最小化必须进行的重新分配的次数,因而可以避免真分配的开销和迭代器/指针/引用失效。但在我解释reserve为什么可以那么做之前,让我简要介绍有时候令人困惑的四个相关成员函数。在标准容器中,只有vector和string提供了所有这些函数。

(1) size()告诉你容器中有多少元素。它没有告诉你容器为它容纳的元素分配了多少内存。

(2) capacity()告诉你容器在它已经分配的内存中可以容纳多少元素。那是容器在那块内存中总共可以容纳多少元素,而不是还可以容纳多少元素。如果你想知道一个vector或string

中有多少没有被占用的内存,你必须从capacity()中减去size()。如果size和capacity返回同样的值,容器中就没有剩余空间了,而下一次插入(通过insert或push_back等)会引发上面的重新分配步骤。

(3) resize(Container::size_type n)强制把容器改为容纳n个元素。调用resize之后,size

将会返回n。如果n小于当前大小,容器尾部的元素会被销毁。如果n大于当前大小,新默认构造的元素会添加到容器尾部。如果n大于当前容量,在元素加入之前会发生重新分配。

(4) reserve(Container::size_type n)强制容器把它的容量改为至少n,提供的n不小于当前大小。这一般强迫进行一次重新分配,因为容量需要增加。(如果n小于当前容量,vector 忽略它,这个调用什么都不做,string可能把它的容量减少为size()和n中大的数,但string 的大小没有改变。在我的经验中,使用reserve来从一个string中修整多余容量一般不如使用“交换技巧”,那是条款17的主题。)

这个简介表示了只要有元素需要插入而且容器的容量不足时就会发生重新分配(包括

它们维护的原始内存分配和回收,对象的拷贝和析构和迭代器、指针和引用的失效)。所以,避免重新分配的关键是使用reserve尽快把容器的容量设置为足够大,最好在容器被构造之后立刻进行。

例如,假定你想建立一个容纳1-1000值的vector。没有使用reserve,你可以像这样来做:

vector v;

for (int i = 1; i <= 1000; ++i) v.push_back(i);

在大多数STL实现中,这段代码在循环过程中将会导致2到10次重新分配。(10这个数没什么奇怪的。记住vector在重新分配发生时一般把容量翻倍,而1000约等于210。)

把代码改为使用reserve,我们得到这个:

vector v;

v.reserve(1000);

for (int i = 1; i <= 1000; ++i) v.push_back(i);

这在循环中不会发生重新分配。

在大小和容量之间的关系让我们可以预言什么时候插入将引起vector或string执行重新分配,而且,可以预言什么时候插入会使指向容器中的迭代器、指针和引用失效。例如,给出这段代码,

string s;

...

if (s.size() < s.capacity()) {

s.push_back('x');

}

push_back的调用不会使指向这个string中的迭代器、指针或引用失效,因为string的容量保证大于它的大小。如果不是执行push_back,代码在string的任意位置进行一个insert,我们仍然可以保证在插入期间没有发生重新分配,但是,与伴随string插入时迭代器失效的一般规则一致,所有从插入位置到string结尾的迭代器/指针/引用将失效。

回到本条款的主旨,通常有两情况使用reserve来避免不必要的重新分配。第一个可用的情况是当你确切或者大约知道有多少元素将最后出现在容器中。那样的话,就像上面的vector 代码,你只是提前reserve适当数量的空间。第二种情况是保留你可能需要的最大的空间,然后,一旦你添加完全部数据,修整掉任何多余的容量。

2.使用“交换技巧”来修整vector过剩空间/内存

有一种方法来把它从曾经最大的容量减少到它现在需要的容量。这样减少容量的方法常常被称为“收缩到合适(shrink to fit)”。该方法只需一条语句:vector(ivec).swap(ivec); 表达式vector(ivec)建立一个临时vector,它是ivec的一份拷贝:vector的拷贝构造函数做了这个工作。但是,vector的拷贝构造函数只分配拷贝的元素需要的内存,所以这个临

时vector没有多余的容量。然后我们让临时vector和ivec交换数据,这时我们完成了,ivec 只有临时变量的修整过的容量,而这个临时变量则持有了曾经在ivec中的没用到的过剩容量。在这里(这个语句结尾),临时vector被销毁,因此释放了以前ivec使用的内存,收缩到合适。

3.用swap方法强行释放STL Vector所占内存

template < class T> void ClearVector( vector& v )

{

vectorvtTemp;

vtTemp.swap( v );

}

vector v ;

nums.push_back(1);

nums.push_back(3);

nums.push_back(2);

nums.push_back(4);

vector().swap(v);

/* 或者v.swap(vector()); */

/*或者{ std::vector tmp = v; v.swap(tmp); }; //加大括号{ }是让tmp退出{ }时自动析构*/

五、Vector 内存管理成员函数的行为测试

C++ STL的vector使用非常广泛,但是对其内存的管理模型一直有多种猜测,下面用实例代码测试来了解其内存管理方式,测试代码如下:

#include

#include

using namespace std;

int main()

{

vector iVec;

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //1个元素,容器容量为1

iVec.push_back(1);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //2个元素,容器容量为2

iVec.push_back(2);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //3个元素,容器容量为4

iVec.push_back(3);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //4个元素,容器容量为4

iVec.push_back(4);

iVec.push_back(5);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //5个元素,容器容量为8

iVec.push_back(6);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //6个元素,容器容量为8

iVec.push_back(7);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //7个元素,容器容量为8

iVec.push_back(8);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //8个元素,容器容量为8

iVec.push_back(9);

cout << "容器大小为: " << iVec.size() << endl;

cout << "容器容量为: " << iVec.capacity() << endl; //9个元素,容器容量为16

/* vs2005/8 容量增长不是翻倍的,如

9个元素容量9

10个元素容量13 */

/* 测试effective stl中的特殊的交换swap() */

cout << "当前vector 的大小为: " << iVec.size() << endl;

cout << "当前vector 的容量为: " << iVec.capacity() << endl;

vector(iVec).swap(iVec);

cout << "临时的vector对象的大小为: " << (vector(iVec)).size() << endl; cout << "临时的vector对象的容量为: " << (vector(iVec)).capacity() << endl; cout << "交换后,当前vector 的大小为: " << iVec.size() << endl;

cout << "交换后,当前vector 的容量为: " << iVec.capacity() << endl;

return 0;

}

六、vector的其他成员函数

c.assign(beg,end)

将[beg; end)区间中的数据赋值给c。

c.assign(n,elem)

将n个elem的拷贝赋值给c。

c.at(idx)

传回索引idx所指的数据,如果idx越界,抛出out_of_range。

c.back()

传回最后一个数据,不检查这个数据是否存在。

c.front()

传回地一个数据。

get_allocator

使用构造函数返回一个拷贝。

c.rbegin()

传回一个逆向队列的第一个数据。

c.rend()

传回一个逆向队列的最后一个数据的下一个位置。

c.~ vector ()

销毁所有数据,释放内存。

中考英语口语辅导:consider的用法

中考英语口语辅导:consider的用法 表示“考虑”,其后可接动名词,但不能接不定式。如He is considering changing his job. 他在考虑调换工作。I’ve never really considered getting married. 我从未考虑过结婚的事。注:consider 之后虽然不能直接跟不定式,但可跟“疑问词+不定式”结构。如Have you considered how to get there / how you could get there. 你是否考虑过何到那儿去?2. 表示“认为”、“把……看作”,下面三个句型值得注意(有时三者可互换) (1) consider +that从句(2) consider+宾语+(as +)名词或形容词(3) consider+宾语+(to be +)名词或形容词I consider him (as) honest (或an honest man). I consider him (to be) honest (或an honest man). I consider that he is honest (或an honest man). 注:(1) 以上备句意思大致相同,对于consider 之后能否接as 的问题,尚有不同看法(即有人认为不能接as ,有人认为可以拉as,但实际上接as 的用法已很普遍)。(2) 在“consider+宾语”之后除可接to be 外,有时也可to do 型动词(但多为完成形式)。如We all considered him to have acted disgracefully. 我们都认为他的行为很不光彩。

疑问代词用法总结及练习

疑问代词用法总结及练习 句子是英语学习的核心。从句子使用的目的来分,它可分为四类 1、陈述句(肯定句和否定句) 2、疑问句(一般疑问句、特殊疑问句和选择疑问句) 3、祈使句(肯定句和否定句) 4、感叹句。 四大句子类型的相互转换,对于学生来讲是个难点,为此,可通过说顺口溜的形式来帮助学生解决这一难题。 如:将陈述句变成一般疑问句,可以变成这样的顺口留:疑问疑问调个头,把be(系动词“is are am”)放在最前头。 如:将陈述句的肯定句变成否定句,我们就可以这样说:否定,否定加“not”,加在何处,加在系动词的后面。 在句子相互转换的题型中,最难的要算“就下列划线部分提问”或是“看答句,写问句”这种题型了,其实,我们只要熟练掌握疑问词(what,what time, what colour, where, when, who, whose, which, how, how old ,how tall, how long, how big, how heavy , how much, how many等等)具体用法。

习题 一、选择正确的单词填空 (who, where, when) is that pretty girl She is my sister. are Jack and Tom They are behind you. do you go to school I go to school from Monday to Friday. has a beautiful flower John has a beautiful flower.

are they They are my parents. is my mother She is in the living room. are you going We are going to the bakery(面包坊). Jim and Wendy play ball They play ball in the afternoon. does he jog He jogs in the park. are you from I'm from Changchun city. 11. _______ is your birthday –On May 2nd. 12、_______ are you --- I`m in the office. 13. are you ---- I`m Alice. 二.用(what time, what color, what day, what)填空。 1. A: ______ _______ is it B: It is nine o’clock. 2. A: ______ _______ does your mother get up B: My mother gets up at 6:30. 3. A: ______ _______ do you go to bed B: I go to bed at 10:00. 4. A: ______ _______ do Diana and Fiona have supper B: Diana and Fiona have supper at 18:00. 5. A: ______ _______is it B: It is purple. 6. A: ______ _______ is the sky B: The sky is blue. 7. A: ______ _______ is your coat B: My coat is black. 8. A: ______ _______ is the dog B: The dog is white. 9. A: ______ _______ is today B: Today is Monday. 10. A: ______ _______ is tomorrow B: Tomorrow is Tuesday. 11. A: ______ _______ was yesterday B: Yesterday was Sunday. 12. A: ______ _______ do you like B: I like red. 13. A: ______ is this This is a computer. 14. A: ______ are you doing B: We are playing basketball.

consider的基本用法及与regardthinkofabout

consider的基本用法及与regard,think ofabout和look(up)on as的区别 consider的基本用法及与regard,think of/about和look(up)on as的区别 consider一词在历年高考中是一个常考的要点,其用法应分为两部分来讲。第一、作“考虑、思考”时的搭配如下: 1.consider+n./pron.,例如: Have you considered the suggestion? That’s what we have to consider now. 2.consider+v-ing,但不能接不定式的一般式,例如: We considered going to see the doctor the next day. Have you considered moving to shanghai recently? You must consider to tell him something about it.(错误) 3.consider+疑问词+不定式,例如: He is considering how to improve his English. We must consider what to do next.

4.consider+从句,例如: We didn’t consider whether he should go or not. Have you considered when we should go there? 第二、作“认为、把……当作/看作”等意思时的搭配如下:1.consider+sb/sth+(to be/as)+n./adj.,例如: I consider him to(be/as)my best friend. Everyone considers him(to be)clever. He considered it much improved. 2.consider+sb./sth.+不定式短语(作宾语补足语),不能接不定式的一般式,例如: We consider them to be working very hard. We consider them to have finished the work. We consider him to be the clever in our class. We must consider him to go there at once.(错误) 3.consider+it+adj./n.+不定式短语,其中it为形式宾语,不定式短语为真正的宾语,例如: Jiao Yulu considered it his duty to serve the people heart and soul. They consider it necessary to set the slaves free.

英语一般疑问句用法总结

英语一般疑问句用法总结 1. 基本用法及结构 一般疑问句用于对某一情况提出疑问,通常可用yes和no来回答,读时用升调。其基本结构是“be / have / 助动词+主语+谓语(表语)”: Is he interested in going? 他有兴趣去吗? Have you ever been to Japan? 你到过日本吗? Does she often have colds? 她常常感冒吗? Did you ask her which to buy? 你问没问她该买哪一个? 2. 陈述句变一般疑问句的方法 (1) 动词be的否定式。动词be根据不同的时态和人称可以有am, is, are, was, were等不同形式,可用作连系动词(表示“是”、“在”等)和助动词(用于构成进行时态和被动语态等),但不管何种情况,构成疑问式时,一律将动词be的适当形式置于句首: Am I right? 我是对的吗? Are you feeling better today? 你今天感到好些了吗? Was he late for school? 他上学迟到了吗? (2) 动词have的疑问式。动词have根据不同的时态和人称可以有have, has, had等形式,可以用作实意动词和助动词,分以下情况讨论:

①用作实意动词表示状态,如表示拥有、患病或用于have to 表示“必须”等,在构成构成式时可以直接将have, has, had置于句首,也可根据情况在句首使用do, does, did: Does he have [Has he] anything to say? 他有什么话要说吗? Do you have [Have you] to leave so soon? 你必须这么早走吗? Did you have [Had you] any friends then? 他当时有朋友吗? ②用作实意动词表示动作,如表示“吃(=eat)”、“喝(=drin k)”、“拿(=take)”、“收到(=receive)”、“度过(=spend)”等,构成疑问式时不能将have提前至句首,而应在句首使用do, does, did: Does he have breakfast at home? 他在家吃早餐吗? Did you have a good time at the party? 你在晚会上玩得高兴吗? ③用作助动词构成完成时态,其疑问式总是将have等置于句首: Have you finished your work? 你的工作做完了吗? Has he left when you arrived? 你到达时他已离开了吗? (3) 情态动词的疑问式。情态动词的疑问式通常是将情态动词置于句首: Can you speak English? 你会说英语吗?

Consider的用法

Consider的用法: -Have you considered_____ the job ss a teacher? -Yes.I like it because a teacher is often considered _______ a gardener. A.to take,to be B.to take,being C.taking,being D.taking,to be 答案:d译文:你考虑过做老师的工作吗? 是的,我非常喜欢,因为老师通常被认为是园丁 一、consider作“考虑”解,常用于以下句型: 1.consider+名词/代词/动名词。 You'd better consider my suggestion. 你最好考虑我的建议。 I’m considering going abroad some day.我一直考虑有一天出国。 2.consider+从句或“疑问词+不定式”。 Have you considered what he suggested? 你们考虑他的建议了吗? We must consider what to do next. 我们必须考虑下一步要做什么。 二.consider作“认为”解时,常用于以下句型: 1.consider sb./sth+.(as)+形容词/名词。其中,as可以省略。 We consider him honest. 我们认为他很诚实。 At first they considered me as a doctor.起初他们认为我是医生。 2.consider+sb./sth.+不定式。其中,不定式通常是to be(可以省略)或其他动词的完成式。We consider this matter to be very important. 我们认为这件事很重要。 We all consider him to have stolen the bike.我们都认为他偷了自行车。 3.consider+it+形容词/名词+不定式短语。 We consider it hard to study English well.我们认为学好英语很难。 I consider it my duty to help you with your studies.我认为帮助你学习英语是我的职责。 4.consider+宾语从句。 We consider that the music is well worth listening to.我们这首音乐很值得一听。 在该题中,前一个句子中的consider作“考虑”解,后接动名词作宾语,但不可接不定式,由此可以排除A, B; 后一个句子中的consider作“认为”解,用到句型consider+sb./sth.+不定式,此处使用的是被动语态结构。故答案为D项。 请看下面两道考题,均考查“with+宾语+非谓语动词”结构: 1.—Come on, please give me some ideas about the project. —Sorry. With so much work _________my mind, I almost break down. A.filled B.filling C.to fill D.being filled 2.John received an invitation to dinner, and with his work _________, he gladly acc epted it. A.finished B.finishing C.having finished D.was finished 以上两题答案分别为B和A,均考查“with+宾语+非谓语动词”结构。该结果中的“非谓语动词”可以是不定式、现在分词、过去分词,它们在用法上的区别如下:

一般疑问句、选择疑问句的详细用法备课讲稿

一般疑问句、选择疑问句的详细用法

一般疑问句、 (一)一般疑问句 1、一般疑问句概述 一般疑问句(general questions),也可称为“yes/no” questions(是否型问句),因为它一般是由yes或no回答的,如: —Can you swim to the other side?你能游到对岸吗? —Yes, I can.是的,我能。 —No,I can’t.不,我不能。 —Have you locked the door?你锁门了吗? —Yes,I have.是的,锁了。 —No,I haven’t. 不,没有锁。 2一般疑问句的结构 (1)基本的结构为:be/助动词/情态动词+主语+谓语/表语+(其他),句子要读升调,如: Are they your friends?他们是你的朋友吗? Does he go to school on foot?他是步行去上学吗? Will you be free tonight?你今晚有空吗? Can you play basketball?你会打篮球吗? (2)陈述句亦可用作一般疑问句,多用在非正式文体中,句末有问号,用升调,如: Somebody is with you?有人和你一起吗? He didn’t finish the work?他没有做完活吗? You are fresh from America,I suppose?我猜,你刚从美国回来吧? 3、一般疑问句的答语 (1)一般疑问句一般由yes或no来回答,如: —Are you tired?你累了吗? —Yes,I am.是的,累了。 —No, I’m not.不,不累。 —Does she do the cleaning?她扫除了吗?

consider的用法归纳有哪些

consider的用法归纳有哪些 consider的用法:作名词 consideration作名词,意为careful thought and attention斟酌,考虑 Several considerations have influenced my decision.好几个因素影响了我的决定。 1.Consideration for顾及,体贴 He has never shown much consideration for his wife’s needs.他从来不顾及他妻 子的需要。 2.Under consideration在讨论/考虑中 Several projects are under consideration.好几个项目在讨论中。 There are some proposals under consideration. 有几个建议在审议中。 3.Take sth. into consideration考虑到某事,体谅 Your teachers will take your recent illness into consideration when marking your exams. 你的几位老师在给你的考试评分时,会考虑你最近生病这一情况的。 4.Leave sth. out of consideration 忽略/不重视某事 It was wrong to leave my feelings out of consideration.不顾及我的情感是不对的。 5.Show consideration for体谅,顾及 Jeff never shows any consideration for his mother’s feelings.杰夫从来不体谅他 母亲的感受。 6.of. No / little consideration无关紧要的,不重要的 Whether he would go with us or not was of no consideration. 他是否跟我们一起 去是无关紧要的。 7.In consideration of sth.作为对……的汇报,考虑到 It’s a small payment in consideration of your services.这是答谢您服务的微薄酬金。 consider的用法:作动词 1.Consider作动词,意为think about sth.考虑,斟酌 常用搭配:consider sth. / doing sth. / where(how, why)+to do /that clause; all things considered通盘考虑,考虑到问题的各个方面。如:

特殊疑问句和一般疑问句的用法

(一)由be(am,is,are)引导的一般疑问句 1、Am I a student? 我是学生吗? Yes,you are./ No,you aren’t. 2、Is this /that/it a chair?这/那/它/是一把椅子吗? Yes,it is. /No,it isn’t. 3、Is she/Amy your sister?她/艾米是你的妹妹吗?Yes,she is ./ No,she isn’t. 4、Is he/Mike your brother?他/迈克是你的哥哥吗?Yes,he is./No,he isn’t. 5、Is your brother helpful at home? 你哥哥在家有用吗?Yes, he is./ No, he isn’t. 6、Is there a forest in the park? 在公园有一个森林吗? Yes,there is./No,there isn’t. 是的,有。/不,没有。 7、Are there any panda s in the mountains?在山上有熊猫吗? Yes,there are./No,there aren’t.是的,有。/不,没有。 8、Are they dusk s? 它们是鸭子吗?(问物) Yes, they are. /No,they aren’t.是的,它们是。/不,它们不是。 9、Are they famers? 他们是农民吗?(问人) Yes, they are. /No,they aren’t. 是的,他们是。/不,他们不是。 10、Are you a teacher?你是一个老师吗?(问you 用I回答) Yes, I am./No,I’m not.是的,我是。/不,我不是。 11、Are you teacher s?你们是老师吗? Yes,we are./No,we aren’t.是的,我们是。/不,我们不是。 (二)、由do引导的一般疑问句

否定疑问句的构成和用法

否定疑问句的构成和用法 反意疑问句是在陈述句后边加上一个简短问句,对陈述句所叙述的内容提出相反的疑问,这种句子就叫作反意疑问句。反意疑问句可以表示真实的疑问,也可以表示提问人的倾向、强调或反问。如果陈述句是肯定句时,后边的反意疑问句通常要用否定式;反之,如果陈述句是否定句时,后边的反意疑问句通常要用肯定式。陈述句和后边的反意疑问句的主语以及谓语动词的人称、数、时态通常要保持一致。例如: He speaks English, doesn't he? Mary won't do it, will she? Lies cannot cover up the facts, can they? 回答反意疑问句和回答一般疑问句一样,肯定回答用"Yes, +肯定结构";否定回答用"No, +否定结构"。这与汉语习惯有所不同。例如: -He's a doctor, isn't he?他是医生,对吧? -Yes, he is.对,他是医生。(No, he isn't.不,他不是医生。) -He isn't a doctor, is he?他不是医生,对吧? -Yes, he is.不,他是医生。(No, he isn't.对,他不是医生。) 在使用反意疑问句时,特别要注意以下几点: 1.当动词have作"有"讲时,可以有两种反意疑问句形式。例如: He hasn't any sisters, has he? He doesn't have any sisters, does he? 当have表示其它含义(如:经历、遭受、得到、吃……)讲时,只有一种反意疑问句形式: You all had a good time, didn't you? He often has colds, doesn't he? They had milk and bread for breakfast, didn't they? 2.如果陈述句的谓语动词含有have to, had to时,反意疑问句通常用其适当形式。例如: We have to get there at 8 a.m. tomorrow, don't we? They had to take the early train, didn't they? 3. need和dare既可以作情态动词,又可以作实义动词,注意有两种反意疑问句形式。例如: You needn't hand in your paper today, need you? You don't need to hand in your paper today, do you? He dare ask the teacher, dare not he? He doesn't dare to ask the teacher, does he? 4.如果陈述句的谓语动词含有used to时,也可以有两种反意疑问句形式。例如: He used to live in London, usedn't/ didn't he? 5.如果陈述句中出现never, seldom, hardly, scarcely, rarely, few, little, nobody, no one, nothing等含有否定意义的词时,反意疑问句通常要用肯定式。例如: She seldom goes to the concert, does she? He has few good reasons for staying, has he? 6.如果陈述句中的主语是不定式短语、动名词短语、从句、everything或nothing时,反意疑问句通常要用it作主语。例如: To sell/ Selling newspaper was his job, wasn't it? What he said is true, isn't it? Everything is all right, isn't it? 7.如果陈述句中的主语是不定代词everybody, everyone, somebody, someone, nobody, no one, each of等时,反意疑问句通常要用they或he作主语。例如: Somebody borrowed my bike, didn't they/ he? Each of them passed the exam, didn't they?

consider 用法

consider大致有两种含义。含义不同,用法有别。现归纳如下。 一、 consider作“考虑”解,常用于以下句型: 1. Consider+名词/代词/动名词。 You’d better consider my suggestion. 你最好考虑我的建议。 I’m considering going abroad some day.我一直考虑有一天出国。 2. Consider+从句或“疑问词+不定式”。 Have you considered what he suggested?你们考虑他的建议了吗? We must consider what to do next.我们必须考虑下一步要做什么。 二.Consider作“认为”解时,常用于以下句型: 1. Consider sb./sth+.(as)+形容词/名词。其中,as可以省略。 We consider him honest.我们认为他很诚实。 At first they considered me as a doctor.起初他们认为我是医生。 2.consider+sb./sth.+不定式。其中,不定式通常是to be(可以省略)或其他动词的完成式。We consider this matter to be very important.我们认为这件事很重要。 We all consider him to have stolen the bike.我们都认为他偷了自行车。 3.consider+it+形容词/名词+不定式短语。 We consider it hard to study English well.我们认为学好英语很难。 I consider it my duty to help you with your studies.我认为帮助你学习英语是我的职责。 4.consider+宾语从句。 We consider that the music is well worth listening to.我们这首音乐很值得一听

consider的用法和短语例句

consider的用法和短语例句 consider有考虑;思考;认为;体谅等意思,consider的多种用法你了解多少呢,下面跟着小编一起来学习consider的用法和短语例句吧,希望对大家的学习有所帮助! consider的用法consider的用法1:consider的基本意思是用脑细想和斟酌,也可表示为找到结论而想方设法,还可以表示限定在确定的观点上,即认为。引申可表示关心顾及体谅等。 consider的用法2:consider作考虑解时,可用作不及物动词,也可用作及物动词。用作及物动词可接名词、代词、动名词、带疑问词的动词不定式或wh-从句作宾语。接动名词作宾语时,可用于进行时态。 consider的用法3:consider作认为解时,是正式语体,可接that 从句作宾语,也可接复合宾语。其宾语补足语可由名词、形容词、介词短语、动词不定式、现在分词、过去分词等充当。在用作宾语补足语的名词、形容词或介词短语之前,有时可插入to be或as。如果to be表示的时间先于谓语动词,则不可省略且须用完成时。consider 作关心,体谅,顾及解时,一般接名词作宾语。 consider的用法4:consider的过去分词considered有时可用作定语用来修饰其他名词,意思是考虑过的。 consider的用法5:consider可用于被动结构。

consider的常用短语consider over (v.+prep.) 考虑think about (sth) consider over sth consider相关词汇辨析consider,think,believe,count,deem,reckon,regard 这些动词均含有认为之意。 consider 指经过考虑和观察后得出的结论。 think 普通用词,指按照自己的意见提出看法。 believe 通常指根据一定的证据,经思考后而认为属实。 count 指作出判断后而得出的看法等。 deem 正式用词,常用于法律、文学,强调作判断而不是思考。 reckon 指对人或事作全面权衡,把各方面意见考虑进去后得出结论。 regard 侧重凭外表或表面现象作判断。多强调观点。 consider to do还是consider doing? I am considering to write an article.这个句子要表达的意思是:我正在考虑些一片文章。 句中出现consider这个词,它是名词consideration的动词形式。它是指考虑某人或某事物,尤其是指以做决定为目的的,细想。 我们先来熟悉一下这个词的用法,它的习惯用法有consider+名词或代词等,consideration+宾语从句,还有consider somebody or something for something or somebody或者是

2016江西单招测试题英语知识点:consider的用法

考单招——上高职单招网https://www.doczj.com/doc/ed14951796.html, consider的用法 vt. 考虑;认为 常用结构 consider doing sth./sth.考虑做某事 consider sb./sth. as/to be ...认为;以为;觉得consider it+adj.+to do sth ...认为做某事是……联想拓展 consideration n. 考虑;关心considering prep. 考虑到;就……而言take sth. into consideration 考虑(某事) Considering her age, she has done very well. 考虑到她的年纪,她已经做得非常好了。 例句 We are considering going to Canada. 我们正考虑到加拿大去。 We consider this (to be) very important. 我们认为这非常重要。

考单招——上高职单招网https://www.doczj.com/doc/ed14951796.html, Would you consider yourself a feminist? 你认为自己是女权主义者吗? But consider the upside, they urged readers. 但考虑到其好处,他们怂恿读者。 Do you consider your carbon footprint? 你会考虑碳足迹吗? Consider the cells in your own body. 想一下你身体里的细胞。 Consider mr de wever's sloganeering. 仔细研究一下德维沃的竞选口号吧。 常见练习 (1)单项填空 Charlie Chaplin is to be one of the greatest actors in the world. (2009·02·湖北武汉一中质量检测) A. Regarded B. believed C. thought D. considered (2)翻译句子 (原创) ①你是否考虑过如何到达那里?

一般疑问句用法总结

1. 一般疑问句的构成:谓语动词提前或者是助动词提前,其他句子成分顺序不变,译为是否……?肯定回答为yes加主语和谓语的肯定形式;否定回答为no加主语和谓语的否定形式。 1)一般现在时时态中和一般过去时时态的一般疑问句 eg. It snows here in winter. Does it snow here in winter? Yes, it is. / No, it isn’t. She likes reading books during her spare time Does she like reading books during her spare time? Yes, she does. / No, she doesn’t. I went to the big park near my house with my friends. Did you go to the big park near your house with your friends? He was a science teacher ten years ago. Was he a science teacher ten years ago? Mother used to offer afternoon tea for us in the living-room Used mother to offer afternoon tea for you in the living-room? Yes, she used to. / No, she used not to Did mother use to offer afternoon tea for you in the living-room? Yes, she did. / No, she did not to 注意used to 后接动词不定式表示过于习惯的动作或状态,但是表示的过去习惯和状态不复存在。be used to doing表示习惯做某事。 练习把以下句子变成一般疑问句 This idea sounds good. I was used to having a glass of water before going to bed.

consider作动词时主要有以下四种用法

consider作动词时主要有以下四种用法: 一、作"思考"、"考虑"(=think about)解,后面可接动名词、由"how, what等+动词不定式"或者从句作宾语.但要特别注意,consider后面不能直接跟动词不定式作宾语。例如: ①We are considering going to Hainan for the Spring Festival.我们在考虑赴海南过春节。 ②He has never considered how to solve the problem. 他从未考虑过如何解决那个问题。 ③Do you consider that we can finish the project ahead of time?你认为我们能提前完成这个项目吗? 二、consider v.还可作"顾虑到"、"顾及"、"体谅"(=take into account)解。这时其后用名词或动名词作宾语。例如: ①All of you should consider the feelings of other people. 你们必须顾及到他人的感情。 ②Although he has made such a stupid mistake, you should consider his youth.尽管他犯了那样愚蠢的错误,你应该体谅他还年轻。 三、作"认为"、"以为"、"觉得"(=be of the opinion, regard as)解时,后面多接宾语从句,这时一般不接动名词作宾语。例如: ①I consider that he is fit for the position of the manager. 我认为他胜任经理的位置。 ②We consider that you are not to blame.我们认为这不是你的错。 ③He has never considered the fact that his family is not very rich.他从未考虑过他家并不富裕这一事实。 consider作"认为"解时,后面还可以接一个宾语和一个动词不定式作宾语补足语,构成复合宾语结构,但这种结构的动词不定式主要是"to be+名词/形容词";有时也可以是其它不定式,不过这种不定式多用完成时。例如: ①We always consider him to be a weak leader. 我们一直认为他是个能力不强的领导。 ②They consider Jim (to be) the cleverest boy in their class. 他们认为吉姆是他们班最聪明的学生。 ③I consider her to have done wonderfully in the final exam. 我认为她在期末考试中表现得非常出色。 注:consider作"认为"解时,后面偶尔也出现接不定式作宾语的情况,不过这时大都用形式宾语it,而将真正的宾语后移。例如: Do you consider it wise to interfere?你觉得干预是明智的吗? 四、固定结构"consider... as/ to be+名词/形容词"多侧重于表示经过思考"认为……是……"。例如: ①We consider his suggestion as having possibilities. 我们认为他的建议具有可行性。 ②They considered the plan as reasonable. 他们认为这个计划是合理的

英语四种疑问句的用法归纳

英语四种疑问句的用法归纳一、学习一般疑问句的五个要点 就全句提出问题,希望对方给予肯定或否定答复的问句,叫做一般疑问句。回答时要用Yes或No来开头,句末用问号,朗读时用升调。 (一)、一般疑问句的基本结构 1. 如果谓语中有情态动词、助动词或be,将这些词移到主语之前。如: Eg: Can you dance 你会跳舞吗? Will he go there tomorrow 他明天去那里? Are you a student 你是学生吗? 2. 如果谓语中没有情态动词、助动词或be,就在主语前加助动词do(does、did) ,原来的 动词都用原形。如: Eg: Do you like English 你喜欢英语吗? Does your brother like English 你的兄弟喜欢英语吗? Did you sleep well last night 你昨晚睡得好吗? 注:have做助动词时,将其移至主语前;作“有”解时也可以将其移至主语前;不是作“有”解的为行为动词时,其疑问式和其他行为动词一样要在主语前加do(does、 did) 。如: Eg: Has he gone to England 他到英国去了? Have you (=Do you have) a car 你有汽车吗? Do you have lunch at school 你是在学校吃中饭的吗? (二)、一般疑问句的简略回答 Eg: —Can you swim 你会游泳吗? —Yes, I can. (No, I can’t) 会。(不会) —Have you finished your work 你工作做完了吗? —Yes, I have. (No, I haven’t. ) 做完了。(还没有。) —Is this your pen 这是你的钢笔吗?? —Yes, it is. (No, it isn’t) 是的。(不是。) (三)、一般疑问句的否定形式 当说话人或是期待肯定的回答或是不期待对方的回答时用否定式。其结构,在口语里,总是把not与情态动词、助动词或be缩略成一个词;有时也将not放在主语后。如: Eg: Can’t you see the kite 难道你看不到那个风筝? Don’t you like playing football 难道你不喜欢踢足球? Aren’t you (=Are you not) a You Pioneer 难道你不是少先队员? (四)、注意否定疑问句的回答 英语的yes和no是对答语的肯定或否定,而不是对问句的肯定或否定,所以只要答语是肯定的,就用“Yes+肯定结构”,答语是否定的,就用“No+否定结构”。这与汉语的习惯不同。请比较: Eg: —Won’t he go to the hospital 难道他不去医院了? —Yes, he will . (No, he won’t. ) 不,他去。(是的,他不去。) —Can’t you speak English 你难道不会讲英语吗? —Yes, I can . (No, I can’t. ) 不,我会。(是的,我不会) 二、学习特殊疑问句的三个要点

相关主题
文本预览
相关文档 最新文档