实验题3.向量运算new

实验题3.向量运算new

ID:34524064

大小:190.48 KB

页数:7页

时间:2019-03-07

实验题3.向量运算new_第1页
实验题3.向量运算new_第2页
实验题3.向量运算new_第3页
实验题3.向量运算new_第4页
实验题3.向量运算new_第5页
资源描述:

《实验题3.向量运算new》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、课程:《程序设计II》2009-2010学年第二学期班级:信息安全09、网络工程09教师:吴维刚实验题3.向量运算2010/5/28Contents1前言···········································································································································11.1实验目的···································································

2、····················································11.2实验环境·······················································································································12实验内容··········································································································

3、·························12.1题目描述·······················································································································12.2实验要求·······················································································································32.3结果提交····

4、···················································································································52.4实验评价标准···············································································································6课程:《程序设计II》2009-2010学年第二学期班级:信息安全09、网络工程09教师:吴维刚1前言注意:

5、请务必仔细阅读本文档以顺利完成实验。若对本次实验作业有任何疑问,请发邮件到wuhefeng@gmail.com。1.1实验目的本次实验旨在帮助同学们巩固运算符重载的相关知识,灵活运用所学编程知识,锻炼综合运用能力。1.2实验环境本实验基于VisualStudio开发平台,参考主流的编码规范。1.2.1编程语言和开发工具编程语言:ANSIC/C++开发工具:VisualStudio20051.2.2编码规范要求遵循良好的程序设计风格来设计和编写程序。基本编码规范:1.标识符的命名要到达顾名思义的程度;2.提供必要、清晰、准确的注释;3.程序版面要求:a)不同功能块用空行分隔;b

6、)一般一个语句一行;c)语句缩进整齐、层次分明;4.请注意《实验成绩评定总则及代码规范要求》文档中的代码规范要点。2实验内容2.1题目描述实现简单的向量运算:加法、减法、点乘。2.1.1设定描述向量定义-1-课程:《程序设计II》2009-2010学年第二学期班级:信息安全09、网络工程09教师:吴维刚向量是一个n元组(p1,p2,…,pn)。其中n是向量的维数,p1,p2,…,pn则是向量的元素。为了简单起见,这里假设元素为整数,即p1,p2,…,pn∈Z.单个整数也看作一个向量,即维数为1。空向量:即维数为0的向量。类设定在这里预设定了向量类Vector,并加入了基本

7、的数据成员。其中,dims为向量的维数,elements用来顺序存放向量的元素。你可根据需要自主添加其他的数据成员和方法。classVector{public://addmethods…protected:intdims;//dimensionofvectorvectorelements;//elementsofvector//addmoredataifnecessary…};2.1.2运算符描述下面将详细描述需要重载的5种运算符,包括以下两类:⑴算术运算符:加法运算符(+),减法运算符(-)

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。