Saturday, 31 October 2015

C++ Program To Convert Celsius To Fahrenheit And Vice Versa Using Switch Case

Problem:- c++ program to convert Celsius to Fahrenheit and vice versa using switch or Write A Program For Temperature Conversion Celsius To Fahrenheit And Vice Versa Using Switch Case or c++ program to convert Celsius to Fahrenheit and vice versa using class or c++ program to convert Celsius to Fahrenheit and vice versa using switch or write a c++ program to convert Celsius to Fahrenheit or c++ program to convert Celsius to Fahrenheit using function or c program for temperature conversion using the switch case or c++ program to convert Celsius to Fahrenheit and vice versa using function or c++ temperature conversion program using functions or flowchart to convert Celsius to Fahrenheit and vice versa.

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.


Logic:- For Converting Temperature Celsius to Fahrenheit, we are using a given Formula. We have just take a value or temperature in Celsius or Fahrenheit by the user and put the values in given formula and print the outcome given by formula on screen. Here in this problem we are given three option to the user and user have to choose any one of the first choices is Celsius To Fahrenheit, the second choice is Fahrenheit To Celsius and the Last one is Exit without testing any one of the queries.

Formula's


Celsius To Fahrenheit:-


Fahrenheit=(Celsius*9/5)+32;


Fahrenheit To Celsius:-

Celsius=(Fahrenheit-32)*5/9;


You can also check this program in C Language C Program For Converting Temperature Celsius Into Fahrenheit

Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.



Solution:-
#include<iostream>
using namespace std;
int main()
{
  int a;
  cout<<"1. For Celsius To Fahrenheit. \n";
  cout<<"2. For Fahrenheit To Celsius. \n";
  cout<<"3. For Exit\n\n";
  cout<<"Enter Your Choice \n ";
  cin>>a;
  switch(a)
 
    double cel,feh;
    case 1: cout<<"Enter The Temperature In Celsius\n";
      cin>>cel;
      feh=(cel*9/5)+32;
      cout<<"\nTemperature In Fahrenheit Is = "<<feh ;
    break;
   
   case 2: cout<<"Enter The Temperature In Fahrenheit\n";
      cin>>feh;
      cel=(feh-32)*5/9;
      cout<<"\nTemperature In Celsius Is = "<<cel ;
    break;
      
   case 3:exit(0);
   
   default:cout<<"\nEnter The Right Choice \n";
    break;     
  }
}

Output:-

1. Celsius To Fahrenheit

C++ Program For Temperature Celsius To Fahrenheit

2.Fahrenheit To Celsius


C++ Program For Temperature Fahrenheit To Celsius


You May Also Like


1. C++ Program To Display Size Of Different Datatype

2. C++ Program To Check Number Is Positive Or Negative

3. C++ Program To Find Character Is Vowel Or Not

4. C++ Program To Calculate Factorial Of A Given Number


Ghanendra Yadav
Ghanendra Yadav

I Am Ghanendra Yadav Owner Of This Website. I Love Programming, Web Developing, Logo Making, Banner And Website designing. Currently I Am Studying In NIT Warangal And Also Working With WSDC( As Web Application Developer ) In NIT Warangal For Any Query Mail Me I Will Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment