- 1、本文档共8页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
(精品课件)第一次作业(9.13评讲)
Chapter 1
P10 Exercises 1.2 E1 (a)(e)(i)
E1.
Determine by hand calculation what will happen to each of the configurations shown in Figure 1.1 over the course of five generations.
Figure repeats itself.
p17 Exercises 1.3 E1(a) E9
E1.
What classes would you define in implementing the following projects? What methods would your classes possess?
(a) A program to store telephone numbers.
Answer The program could use classes called Phone_book and Person. The methods for a Phone_book object would include look_up_name, add_person, remove_person. The methods for a Person object would include Look_up_number. Additional methods to initialize and print objects of both classes would also be useful.
class Person{
public:
Person(string aname, string aNumber );
string Look_up_number (string aname);
void Print_Person();
private:
string name;
string phoneNumber;
other propertys;
};
const int max_store_size;
class Phone_book{
public:
void initialize();
void add_person(string aname,string aNumber);
void remove_person(string aname);
string Look_up_name();
string Look_up_number();
void Print_Phone_book();
private:
string phone_list[max_store_size][2];
}
E9.
Design a program that will plot a given set of points on a graph.
The input to the program will be a text ?le, each line of which contains two numbers that are the x and y coordinates of a point to be plotted.
The program will use a function to plot one such pair of coordinates. The details of the function involve the speci?c method of plotting and can not be written since they depend plotting on the requirements of the plotting equipment,which we do not know.
Before plotting the points the program needs to know the maximum and minimum values of x and y that appear in its input ?le.
The program should therefore use another function bounds that will read the whole ?le and determine these four maxima and minima. Afterward,another function is used to draw and label the axes;then the ?le can be reset and the individual
文档评论(0)