Search
 
SCRIPT & CODE EXAMPLE
 

CPP

C++ celsius to fahrenheit

 	float cel, far;
    
    cout << "Enter the temperature in Celsius: ";
    cin >> cel;

    far = (cel * 1.8) + 32;      //(°C * 1.8) + 32 = °F

    cout << "The temperature of " << cel << " in Fahrenheit is: " << far;
Comment

C++ Fahrenheit to Celsius

    float far, cel;
    
    cout << "Enter the temperature in Fahrenheit: ";
    cin >> far;

    cel = (far - 32) / 1.8;      //(°F - 32) / 1.8 = °C

    cout << "The temperature of " << far << " in Celsius is: " << cel;
Comment

C++ program for Celsius to Fahrenheit and Fahrenheit to Celsius conversion using class

/* Write a C++ Program to design a class Temperature
with two float variables fahren and celsius
and a member function 'conversion' to convert 
fahrenheit into celsius
*/
#include<iostream>

using namespace std;

// define a class Temperature

class Temperature
{
	private:
	float fahren, celsius;
	public:
	float conversion(float f)
	{
		fahren=f;
		celsius=(fahren-32)* 5.0/9.0;
		return celsius;
	}
	
};
int main()
{
	// define an object of Temperature class
	Temperature t;
	float f;
	cout<<"Enter Temperature in Fahrenheit=";
	cin>>f;
	// call conversion function with object t
	cout<<"Temperature in Celsius="<<t.conversion(f);

return 0;
}
Comment

c++ program to convert fahrenheit to celsius

#include<iostream>
using namespace std;
float scropio(float happy);
int main()
{
	float celcious;
	float fahrenhiet;
	cout<<"Please enter the tem in Fahrenhiet=";
	cin>>fahrenhiet;;
	cout<<"F.";
	celcious=scropio(fahrenhiet);
	cout<<"
Celcious="<<celcious<<" C."<<endl;
	cout<<endl;
	return 0;
}
float scropio(float fahrenhiet)
{
	float celcious;
	celcious = ((fahrenhiet-32)*5/9);
	return celcious;
}
Comment

c++ program to convert celsius to fahrenheit

#include<iostream>
using namespace std;
float scropio(float happy);
int main()
{
	float celcious;
	float fahrenhiet;
	cout<<"Please enter the tem in Celcious=";
	cin>>celcious;
	cout<<"F.";
	fahrenhiet=scropio(celcious);
	cout<<"
Fahrenhiet="<<fahrenhiet<<" F."<<endl;
	cout<<endl;
	return 0;
}
float scropio(float celcious)
{
	float fahrenhiet;
	fahrenhiet = ((celcious+32)*9/5);
	return fahrenhiet;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: infinity c++ 
Cpp :: rotation to vector2 godot 
Cpp :: c++ edit another processes memory address 
Cpp :: uri online judge 3145 solution in c++ 
Cpp :: constant pointer c++ 
Cpp :: rapidjson write stringbuffer to file 
Cpp :: error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ 
Cpp :: dev c++ tahe last word error 
Cpp :: can you chnage the address of a pointer 
Cpp :: C++ std::async wait is taking forever 
Cpp :: cpp iterate words of string 
Cpp :: exit() in c++ 
Cpp :: delete 2d dynamic array c++ 
Cpp :: regex for phone number c++ 
Cpp :: c++ display numbers as binary 
Cpp :: capacity() in c++ 
Cpp :: vector of structs c++ 
Cpp :: char vector to string c++ 
Cpp :: c++ virtual function in constructor 
Cpp :: setw in c++ 
Cpp :: how to print fixed places after decimal point in c++ 
Cpp :: read struct from file c++ 
Cpp :: how to make a n*n 2d dynamic array in c++ 
Cpp :: check if an element is in a map c++ 
Cpp :: how to do (binary) operator overloading in c++ 
Cpp :: how to find length of character array in c++ 
Cpp :: c++ check if char is number 
Cpp :: substring to int c++ 
Cpp :: how to get size of char array in c++ 
Cpp :: min heap and max heap using priority queue 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =