C ++代码:
cout << "Roots are complex and different." << endl;
cout << "x1 = " << realPart << "+" << imaginaryPart << "i" << endl;
cout << "x2 = " << realPart << "-" << imaginaryPart << "i" << endl;
如何将此转换为Turbo C,如printf
而不是cout
?
答案 0 :(得分:1)
你可能正在寻求这个:
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
代替chrome.tabs.executeScript(null,{code:"document.body.style.backgroundColor='yellow'"});
。