Search This Blog
Welcome to 1printf(), your ultimate destination for C, C++, Linux, Data Structures, and Microcontroller programming! ๐ ๐นLearn advanced coding techniques in C& C++ ๐นMaster Linux internals & shell scripting ๐นDeep dive into Data Structures & Algorithms ๐นExplore Embedded Systems & Microcontrollers (8051,UART, RTOS) ๐นGet hands-on coding tutorials, project ideas,and interview preparation tips Whether you're a beginner or an experienced programmer, this channel will help you
Featured
- Get link
- X
- Other Apps
C++ Program to Convert Celsius to Fahrenheit Using Inline Function
C++ Program to Convert Celsius to Fahrenheit Using Inline Function
#include <iostream>
using namespace std;
inline float celsiusToFahrenheit(float c)
{
return (c * 9 / 5) + 32;
}
int main()
{
float c;
cout << "Enter temperature in Celsius: ";
cin >> c;
cout << "Fahrenheit = "
<< celsiusToFahrenheit(c);
return 0;
}
๐ Explanation:
This C++ program converts temperature from Celsius to Fahrenheit using an inline function.
The inline function celsiusToFahrenheit() applies the formula:
Fahrenheit = (Celsius × 9 / 5) + 32
Since the function is small and frequently used, declaring it as inline can improve performance by reducing function call overhead.
๐งพ Sample Output:
Enter temperature in Celsius: 25 Fahrenheit = 77
๐ Keywords:
C++ inline function temperature conversion, Celsius to Fahrenheit program, inline function example in C++, C++ basic programs
๐ Search Description:
Learn how to convert Celsius to Fahrenheit in C++ using inline function. Includes full program, explanation, and output.
๐ Hashtags:
#CPlusPlus #InlineFunction #TemperatureConversion #CPPBasics #CelsiusToFahrenheit #1printf
Popular Posts
C++ Program for Hybrid Inheritance (All Types Together)
- Get link
- X
- Other Apps
C++ Program for Function Overloading Example
- Get link
- X
- Other Apps
Comments
Post a Comment