题目内容

请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1,此工程中包含一个源程序文件main.cpp,其中有类Book(“书”)和主函数main的定义。程序中位于每个“//ERROR****found****”下的语句行有错误,请加以改正。改正后程序的输出结果应该是: 书名:C++语句程序设计总页数:299 已把“C++语言程序设计”翻到第50页 已把“C++语言程序设计”翻到第51页 已把“C++语言程序设计”翻到第52页 已把“C++语言程序设计”翻到第51页 已把书合上。 当前页:0 注意:只修改每个“//ERROR ****found****”下的那一行,不要改动程序中的其他内容。 #include<iostream> using namespace std; class Book char*title; int num_pages;//页数 int cur_page;//当前打开页面的页码,0表示书未打开 public: //ERROR **********found********** Book(const char*theTitle,int pages)num_pages(pages) title=new char[strlen(theTitle)+1]; strcpy(title,theTitle); cout<<endl<<"书名:"<<title<<"总页数:"<<num_pages; ~Book()delete[]title;) bool isClosed()constreturn cur_page==0; //书合上时返回true,否则返回falsebool isOpen()constreturn! isClosed();)//书打开时返回true,否则返回falseint numOfPages()const return num_pages;) //返回书的页数 int currentPage()const return cur_page;) //返回打开页面的页码 //ERROR **********found********** void openAtPage (int page_no) const( //把书翻到指定页 cout<<endl; if(page_no<1 ||page_no>num_pages) cout<<"无法翻到第"<<cur_page<<"页。"; close(); else cur_page=page_no; cout<<"已把“"<<title<<"”翻到第"<<cur_page<<"页"; void openAtPrevPage()openAtPage(cur_page-1);//把书翻到上一页 void openAtNextPage()openAtPage(cur_page+1);//把书翻到下一页 void close() //把书合上 cout<<endl; if(isClosed()) cout<<"书是合上的。"; else //ERROR**********found********** num_pages=0; cout<<"已把书合上。"; cout<<endl; ; int main() Book book("C++语言程序设计",299); book.openAtPage(50); book.openAtNextPage(); book.openAtNextPage(); book.openAtPrevPage(); book.close(); cout<<"当前页:"<<book.current-Page()<<endl; return 0;

查看答案
更多问题

The most damning thing that can be said about the world’s best-endowed and richest country is that it is not only not the leader in health status, but that it is so low in the ranks of the nations. The United States ranks 18th among nations of the world in male life expectancy at birth, 9th in female life expectancy at birth, and 12th in infant mortality. More importantly, huge variations are evident in health status in the United States from one place to the next and from one group to the next.The forces that affect health can be divided into four groupings that lend themselves to analysis of all health problems. Clearly the largest group of forces resides in the person’s environment. Behavior, in part derived from experiences with the environment, is the next greatest force affecting health. Medical care services, treated as separate from other environmental factors because of the special interest we have in them, make a modest contribution to health status. Finally, the contributions of heredity to health are difficult to judge.No other country spends what we do per capita for medical care. The care available is among the best technically, even if used too freely and thus dangerously. Given the evidence that medical care is not that valuable and access to care not that bad, it seems most unlikely that our bad showing is caused by the significant proportion who are poorly served. Other hypotheses have greater explanatory power: excessive poverty, both actual and relative, and excessive wealth.Excessive poverty is probably more prevalent in the U. S. than in any of the countries that have a better infant mortality rate and female life expectancy at birth. This is probably true also for all but four or five of the countries with a longer male life expectancy. In the notably poor countries that exceed us in male survival, difficult living conditions are a more accepted way of life and in several of them, a good basic diet, basic medical care and basic education, and lifelong employment opportunities are an everyday fact of life. In the U. S. a national unemployment level of 10 percent may be 40 percent in the ghetto while less than 4 percent elsewhere. The countries that have surpassed us in health do not have such severe problems. Nor are such a high proportion of their people involved in them.Excessive wealth is not so obvious a cause of ill health, but, at least: until recently, few other nations could afford such unhealthful ways of living. Excessive intake of animal protein and fats, and use of tobacco and drugs, and dangerous recreational sports and driving habits are all possible only when one is wealthy. Our heritage, desires, and opportunities, combined with the relatively low cost of bad foods and speedy vehicles, make us particularly vulnerable. Our unacceptable health status, then, will not be improved appreciably by expanded medical resources nor by their redistribution so much as by a general attempt to improve the quality of life for all. Which of the following questions does the passage provide information to answer()

A. What is the most powerful influence on the health status of a population
B. Which nation in the world leads in health status
C. Is the life expectancy of males in the U.S. longer than that of females
D. What are the most important genetic factors influencing the health of an individual

This problem is far from ______, so it has to be discussed again at tomorrow’s meeting.

A. settled
B. settling
C. being settled
D. being settling

请使用VC6或使用[答题]菜单打开考生文件夹proj2下的工程proj2。此工程中包含一个源程序文件main.cpp,其中有“房间”类Room及其派生出的“办公室”类Office的定义,还有主函数main的定义。请在程序中“//****found****”下的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为: 办公室房间号:308 办公室长度:5.6 办公室宽度:4.8 办公室面积:26.88 办公室所属部门:会计科 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。 #include<iostream> using namespace std; class Room //“房间”类 int room no; //房间号 double length; //房间长度(m) double width; //房间宽度(m) public: Room(int the room_no.double the_length,double the_width):room_no(the_room_no),length(the_length),width(the width) int theRoomNo()constreturn room_no; //返回房间号 double theLength()const returnlength;) //返回房间长度 double theWidth()const returnwidth; //返回房间宽度 //**********found********** double theArea()const______ //返回房间面积(矩形面积) ; class Office:public Room //“办公室”类char*depart; //所属部门 public: Office (int the_room_no.double the_length,double the_width,constchar*the_depart) //**********found********** :______ depart=new char[strlen(the depart)+1]; //**********found********** strcpy(______); ~Office()delete[]depart; const char*theDepartment()constreturn depart;)//返回所属部门 ; int main() //**********found********** Office______; cout<<"办公室房间号:"<<an office.theRoomNo()<<endl <<"办公室长度:"<<an office.the-Length()<<endl <<"办公室宽度:"<<an office.the-Width()<<endl <<"办公室面积:"<<an_office.theArea()<<endl <<"办公室所属部门:"<<an office.theDepartment()<<endl; return 0;

案例分析(要求得出结论并说明理由) 甲素知乙家有钱,且每天白天只有一老妇看家,遂起抢劫意念。为使抢劫顺利,甲先盗窃军用手枪一支,子弹十发。一切准备就绪后,将枪弹藏于身上,来到乙家。时逢老妇偶然外出,甲撬门入室,发现室内无人,于是窃得现金及其他财物总价值一万余元。正准备逃离时,老妇回来,甲遂开枪致老妇重伤后,逃离现场。 请回答以下问题: 该犯罪形态的处断原则是什么

答案查题题库