[英]how to convert this C++ code to Turbo C?
C++代碼:
cout << "Roots are complex and different." << endl;
cout << "x1 = " << realPart << "+" << imaginaryPart << "i" << endl;
cout << "x2 = " << realPart << "-" << imaginaryPart << "i" << endl;
如何將其轉換為 Turbo C 之類的printf
而不是cout
?
可能你正在尋找這個:
printf("Roots are complex and different.\n");
printf("x1 = %lf+%lfi\n",realPart,imaginaryPart);
printf("x2 = %lf-%lfi\n",realPart,imaginaryPart);
如果realPart
和imaginaryPart
變量的數據類型為double
。
否則在代碼中使用%f
表示float
, %d
表示int
, %s
表示string
而不是%lf
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.