complex_test.cpp尽可能注释
来源:互联网 发布:vision软件怎么画图 编辑:程序博客网 时间:2024/06/07 03:32
#include <iostream> //包含iossream头文件#include "complex.h"//包含 complex.h头文件using namespace std;//使用标准命名空间ostream&//重定义<<操作符,返回值类型为ostream 引用operator << (ostream& os, const complex& x)//传入参数(ostream 引用,complex常量引用){ return os << '(' << real (x) << ',' << imag (x) << ')';//返回是一个。。。的内容,通过引用传递}int main(){ complex c1(2, 1); complex c2(4, 0); cout << c1 << endl; cout << c2 << endl; cout << c1+c2 << endl; cout << c1-c2 << endl; cout << c1*c2 << endl; cout << c1 / 2 << endl; cout << conj(c1) << endl; cout << norm(c1) << endl; cout << polar(10,4) << endl; cout << (c1 += c2) << endl; /* 执行+=操作时,将c2的引用传入,执行 complex::operator += (const complex& r) { return __doapl (this, r); } this是c1的自身指针,与r一起执行 inline complex&//设成内联函数 __doapl (complex* ths, const complex& r) { ths->re += r.re;//指针用->,对象用 . ths->im += r.im;//在类声明中,已经将其设置成友元函数,可直接使用私有数据 return *ths;//指针所代表的数据,这个数据用引用方式被其他使用 } 返回指针所代表的数据引用 返回引用 */ cout << (c1 == c2) << endl; cout << (c1 != c2) << endl; cout << +c2 << endl; cout << -c2 << endl; cout << (c2 - 2) << endl; cout << (5 + c2) << endl; return 0;}
0 0
- complex_test.cpp尽可能注释
- complex.h尽可能注释
- main.cpp文件注释
- cpp代码注释
- c注释转换为cpp注释
- C注释转换至CPP注释
- camshiftdemo.cpp的详细注释
- C和CPP注释转换
- caffe convert_mnist_data.cpp 代码注释
- IO注释转换---CPP风格
- 去除cpp中注释的小程序
- Hog源码注释(hog.cpp的注解)
- x265-1.7版本-common/cudata.cpp注释
- x265-1.7版本-common/frame.cpp注释
- x265-1.7版本-common/framedata.cpp注释
- x265-1.7版本-common/intrapred.cpp注释
- x265-1.7版本-common/ipfilter.cpp注释
- x265-1.7版本-common/lowres.cpp注释
- HDU 1671 Phone List 字典树
- 树形dp poj2342
- 架构漫谈(二):认识概念是理解架构的基础
- vb.net 线程处理画面
- Vijos P1911珠心算测验
- complex_test.cpp尽可能注释
- CodeForces 609 A. USB Flash Drives(贪心)
- awk学习 【转】
- Operating Systems: Three Easy Pieces阅读笔记(四)FILE SYSTEM- VSFC&FSCK
- 【bzoj2946】[Poi2000]公共串 后缀自动机
- linux PV操作理解
- Action实现ModelDriven接口后的运行流程
- 安卓通知的使用系列2:状态栏通知和自定义状态栏通知通知
- Java多线程之停止一个线程