ในโปรแกรมนี้เราจะดูวิธีแปลงอุณหภูมิจากเซลเซียสเป็นฟาเรนไฮต์ด้วย C++ สูตรนี้เรียบง่าย

อัลกอริทึม
เริ่มต้น รับอุณหภูมิเซลเซียสใน C คำนวณ F = (9C/5) + 32 คืนค่า F สิ้นสุด
โค้ดตัวอย่าง
#include <iostream>
using namespace std;
int main() {
float f, c;
cout << "Enter temperature in Celsius: ";
cin >> c;
f = (9.0 * c / 5.0) + 32;
cout << "Equivalent Fahrenheit temperature is: " << f;
}
ผลลัพธ์ตัวอย่าง
Enter temperature in Celsius: 37 Equivalent Fahrenheit temperature is: 98.6