[英]how to convert this C++ code to Turbo C?
C++ code: C++代码:
cout << "Roots are complex and different." << endl;
cout << "x1 = " << realPart << "+" << imaginaryPart << "i" << endl;
cout << "x2 = " << realPart << "-" << imaginaryPart << "i" << endl;
How can I convert this to Turbo C like printf
instead of cout
?如何将其转换为 Turbo C 之类的
printf
而不是cout
?
May be you are seeking for this:可能你正在寻找这个:
printf("Roots are complex and different.\n");
printf("x1 = %lf+%lfi\n",realPart,imaginaryPart);
printf("x2 = %lf-%lfi\n",realPart,imaginaryPart);
if realPart
and imaginaryPart
variables are in data type double
.如果
realPart
和imaginaryPart
变量的数据类型为double
。
Use %f
for float
, %d
for int
, %s
for string
instead of %lf
in the code otherwise.否则在代码中使用
%f
表示float
, %d
表示int
, %s
表示string
而不是%lf
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.