如何将此C ++代码转换为Turbo C? [英] how to convert this C++ code to Turbo C?
本文介绍了如何将此C ++代码转换为Turbo C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C ++代码:
cout << "Roots are complex and different." << endl;
cout << "x1 = " << realPart << "+" << imaginaryPart << "i" << endl;
cout << "x2 = " << realPart << "-" << imaginaryPart << "i" << endl;
如何将其转换为printf
而不是cout
的Turbo C?
How can I convert this to Turbo C like printf
instead of 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);
如果realPart
和imaginaryPart
变量的数据类型为double
,则为
.
if realPart
and imaginaryPart
variables are in data type double
.
对于float
使用%f
,对于int
使用%d
,对于string
使用%s
,而不是代码中的%lf
.
Use %f
for float
, %d
for int
, %s
for string
instead of %lf
in the code otherwise.
这篇关于如何将此C ++代码转换为Turbo C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文