請看下面的代碼,讓我知道我沒有看到什麼。我已經嘗試了幾乎所有的東西,以使其工作,但還沒有。For loop with different inputs
在此先感謝您的時間和幫助。
for (double c = c1; c <= c2; c = c + i)
{
cout << "Enter the lowest temperature: " << endl;
cin >> c1;
cout << "Enter the highest temperature: " << endl;
cin >> c2;
cout << "Enter the desired increment in temperature: " << endl;
cin >> i;
f = ((9/5) * c) + 32;
cout << "When C is " << c << " degrees Celsius, the temperature in Fahrenheit will be: " << f << " degrees." << endl;
cin.get();
}
return 0;
}
你會得到什麼錯誤?這是'c1','c2','i'的類型? – Jarod42
我得到這個錯誤的C1和C2錯誤C4700:未初始化的局部變量'C1' – dannyelloko20
爲什麼你問循環的參數不是循環之前,而不是循環內? – Jarod42