当前位置:文档之家› C++ 多线程编程总结

C++ 多线程编程总结

C++ 多线程编程总结
C++ 多线程编程总结

C++ 多线程编程总结

在开发C++程序时,一般在吞吐量、并发、实时性上有较高的要求。设计C++程序时,总结起来可以从如下几点提高效率:

?l 并发

?l 异步

?l 缓存

下面将我平常工作中遇到一些问题例举一二,其设计思想无非以上三点。

1任务队列

1.1 以生产者-消费者模型设计任务队列

生产者-消费者模型是人们非常熟悉的模型,比如在某个服务器程序中,当User数据被逻辑模块修改后,就产生一个更新数据库的任务(produce),投递给IO模块任务队列,IO模块从任务队列中取出任务执行sql操作(consume)。

设计通用的任务队列,示例代码如下:

详细实现可参见

1.2 任务队列使用技巧

注意,此模式下为多任务队列,每个任务队列单线程。

1.2.3 连接池与异步回调

比如逻辑Service模块需要数据库模块异步载入用户数据,并做后续处理计算。而数据库模块拥有一个固定连接数的连接池,当执行SQL的任务到来时,选择一个空闲的连接,执行SQL,并把SQL 通过回调函数传递给逻辑层。其步骤如下:

?n 预先分配好线程池,每个线程创建一个连接到数据库的连接

?n 为数据库模块创建一个任务队列,所有线程都是这个任务队列的消费者

?n 逻辑层想数据库模块投递sql执行任务,同时传递一个回调函数来接受sql执行结果

注意,此模式下为单任务队列,每个任务队列多线程。

2. 日志

本文主要讲C++多线程编程,日志系统不是为了提高程序效率,但是在程序调试、运行期排错上,日志是无可替代的工具,相信开发后台程序的朋友都会使用日志。常见的日志使用方式有如下几种:

?n 流式,如logstream << "start servie time[%d]" << time(0) << " app name[%s]"

<< app_string.c_str() << endl;

?n Printf 格式如:logtrace(LOG_MODULE, "start servie time[%d] app name[%s]", time(0), app_string.c_str());

二者各有优缺点,流式是线程安全的,printf格式格式化字符串会更直接,但缺点是线程不安全,如果把app_string.c_str() 换成app_string (std::string),编译被通过,但是运行期会crash(如果运气好每次都crash,运气不好偶尔会crash)。我个人钟爱printf风格,可以做如下改进:

?l 增加线程安全,利用C++模板的traits机制,可以实现线程安全。示例:

这样,除了标准类型+std::string 传入其他类型将编译不能通过。这里只列举了一个参数的例子,可以重载该版本支持更多参数,如果你愿意,可以支持9个参数或更多。

?l 为日志增加颜色,在printf中加入控制字符,可以再屏幕终端上显示颜色,Linux下示例:printf("\033[32;49;1m [DONE] \033[39;49;0m")

更多颜色方案参见:

?l 每个线程启动时,都应该用日志打印该线程负责什么功能。这样,程序跑起来的时候通过top –H – p pid 可以得知那个功能使用cpu的多少。实际上,我的每行日志都会打印线程id,此线程id 非pthread_id,而其实是线程对应的系统分配的进程id号。

3. 性能监控

尽管已经有很多工具可以分析c++程序运行性能,但是其大部分还是运行在程序debug阶段。我们需要一种手段在debug和release阶段都能监控程序,一方面得知程序瓶颈之所在,一方面尽早发现哪些组件在运行期出现了异常。

通常都是使用gettimeofday 来计算某个函数开销,可以精确到微妙。可以利用C++的确定性析构,非常方便的实现获取函数开销的小工具,示例如下

struct profiler{

profiler(const char* func_name){

gettimeofday(&tv, NULL);

m_func_name=func_name;

}

~profiler(){

struct timeval tv2;

gettimeofday(&tv2, NULL);

long cost = (https://www.doczj.com/doc/5313961339.html,_sec - https://www.doczj.com/doc/5313961339.html,_sec) * 1000000 + (https://www.doczj.com/doc/5313961339.html,_usec - https://www.doczj.com/doc/5313961339.html,_usec);

//! post to some manager

}

struct timeval tv;

const char * m_func_name;

};

#define PROFILER() profiler

____profiler_instance##__LINE__(__FUNCTION__)

Cost 应该被投递到性能统计管理器中,该管理器定时讲性能统计数据输出到文件中。

4 Lambda 编程

使用foreach 代替迭代器

很多编程语言已经内建了foreach,但是c++还没有。所以建议自己在需要遍历容器的地方编写foreach函数。澳门新濠天地https://www.doczj.com/doc/5313961339.html, 习惯函数式编程的人应该会非常钟情使用foreach,使用foreach的好处多多少少有些,如:

但主要是编程哲学上层面的。

示例:

void user_mgr_t::foreach(boost::function func_){

for (iterator it = m_users.begin(); it != m_users.end() ++it){

func_(it->second);

}

}

这样当要改动该接口时,直接在该接口内修改代码,非常直观。

5. 奇技淫巧

利用shared_ptr 实现map/reduce

Map/reduce的语义是先将任务划分为多个任务,投递到多个worker中并发执行,其产生的结果经reduce汇总后生成最终的结果。Shared_ptr的语义是什么呢?当最后一个shared_ptr析构时,将会调用托管对象的析构函数。https://www.doczj.com/doc/5313961339.html, 语义和map/reduce过程非常相近。我们只需自己实现讲请求划分多个任务即可。示例过程如下:

?l 定义请求托管对象,加入我们需要在10个文件中搜索“oh nice”字符串出现的次数,定义托管结构体如下:

?l 定义执行任务的worker

?l 将任务分割后,投递给不同的worker

中考英语口语辅导: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/5313961339.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/5313961339.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. ) 不,我会。(是的,我不会) 二、学习特殊疑问句的三个要点

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