bool就是布尔型,只有true和false;
const是定义常数;
real应该是流体数值软件Fluent的UDF里定义的数据类型,在单精度求解器下相当于float,双精度求解器下相当于double,不属于标准C的类型。
Real 是实数的意思。在复数里,real 表示取实部函数。
应当用小写
#include <complex>
#include <iostream>
int main( )
{
using namespace std
complex <double>c1 ( 4.0 , 3.0 )// c1 是复数
cout <<"The complex number c1 = " <<c1 <<endl
double dr1 = real ( c1 ) // 取c1的实部
cout <<"The real part of c1 is real ( c1 ) = "
<<dr1 <<"." <<endl
double di1 = imag ( c1 ) // 取c1的虚部
cout <<"The imaginary part of c1 is imag ( c1 ) = "
<<di1 <<"." <<endl
}
上面程序 输出
The complex number c1 = (4,3)
The real part of c1 is real ( c1 ) = 4.
The imaginary part of c1 is imag ( c1 ) = 3.
cout<<"c="<<real<<"+"<<这句改成这样:
cout<<"c="<<real<<"+"<<endl
也就是添加一个endl.
那个警告的意思是说,你的入口函数main有没有返回值,系统将会默认返回void类型。,一般可以加上一个return
0