README.md

December 5, 2022 ยท View on GitHub

Simple Hello-World Type C++ Console Temp. Conv.

Description

Converts Either Fahrenheit to Calcius or Calcius to Fahrenheit, Good For Beginners. | If You Like It, Vote Highly For It!

More Info

Must be a console application

Submitted On
ByJeff Katz
LevelBeginner
User Rating4.0 (20 globes from 5 users)
CompatibilityC++ (general)
CategoryComplete Applications
WorldC / C++
Archive File

API Declarations

iostream.h, conio.h

Source Code

#include <iostream.h>
#include <conio.h>
double ctof(double x);
double ftoc(double x);
void ftocf();
void ender();
void ctoff();
int op;
void main ()
{
op=0;
cout<<"Select an Option:"<<endl;
cout<<" 1 for F to C"<<endl;
cout<<" 2 for C to F"<<endl;
cout<<" 3 To End"<<endl;
cin>>op;
if(op==1) ftocf();
if(op==2) ctoff();
if(op==3) ender();
}
void ctoff()
{
int x;
cout<<"Enter Degrees Celcius to Make Into Fahrenheit:"<<endl;
cin>>x;
cout<<"Result: "<<ctof(x)<<endl<<endl;
main();
}
void ftocf()
{
int y;
cout<<"Enter Degrees Fahrenheit to Make Into Celcius:"<<endl;
cin>>y;
cout<<"Result: "<<ftoc(y)<<endl<<endl;
main();
}
double ctof(double x)
{
	return ((x*1.8)+32);
}
double ftoc(double y)
{
	return ((y-32)/1.8);
}
void ender()
{
	cout<<"Press Any Key to Exit"<<endl;
	getch();
}