C++標準ライブラリが提供するcomplex定義の複数オブジェクト学習ノート

539 ワード

complexクラスは複数のデータ型の複数を定義することができ、実部と虚部のデータ型は整数であっても実数であってもよい.すなわち、complexクラスはテンプレートクラスであり、複数のオブジェクトを定義する場合、データメンバータイプを示す.フォーマットは以下の通りである.
complexオブジェクト名(実部値、虚部値);
#include 
#include 
#include 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
	complex comx1(32,45);
	complex comx2(32.5,45.5);
	
	cout <