Tip & How-To about Computers & Internet

# C++ Source code for Celsius to Fahrenheit

#include
#include
#include
using namespace std;
int main(float nNumberofArgs, char* pszArgs[])
{
double celsius;
cout << "Enter the temperature in Celsius:";
cin >> celsius;

double factor;
factor = 212 - 32;

double fahrenheit;
fahrenheit = factor * celsius/100 + 32;

cout << "Fahrenheit value is:";
cout << fahrenheit << endl;
system("PAUSE");
return 0;
}

Posted by on

## Related Questions:

### write a program to sum of all even integer numbers

#include <iostream>
using namespace std;
int main ()
{
int num = 0, i = 1, sum = 0;
cout << "Enter a positive integer: ";
cin >> num;
while (i <= num)
{
sum += i;
i++;
}
cout << "The sum is " << sum << endl;
return 0;
}

Oct 30, 2010 | Compaq Visual Fortran Professional Edition...

### how to drop random letters on the screen using linked list

This is just an example for int you can use your logic for chars

#include <cstdlib>
#include <ctime>
#include <iostream>

using namespace std;

int main() {
srand
(time(NULL));
cout
<< rand() % 10 + 1 << endl; //number between 1 and 10

return 0;
}

May 04, 2009 | Computers & Internet

### how i make calculator by using source code in c++?

hi,
here is the code u looking for

#include <iostream.h>
using namespace std;
float sub (float a, float b)
{
float dif;
dif=a - b;
return dif;
}

float addition (float c, float d)
{
float sum;
sum=c+d;
return sum;
}

float divi (float e, float f)
{
float quo;
quo = e/f;
return quo;
}
float multi (float f, float g)
{
float pro;
pro=f * g;
return pro;
}

int main ()
{
float a;
float b;
float opt;

cout << "Welcome to the calculator" << endl;
cout << "There are four options " << endl;
cout << "Option 1 is subtraction, Option 2 is addition, option 3 is division, and option 4 is multiplication " << endl;
cout << "Enter your option and two digits " << endl;
cin >> opt >> a >> b;

if (opt == 1)
{
float temp= sub (a, b);
cout << "Your difference is " << temp << endl;
}

else
if (opt==2)
{
cout << "Your sum is " << temp2 << endl;
}
else
if (opt == 3)
{
float temp3= divi (a,b);
cout << "Your quotient is " << temp3 << endl;
}
else
if (opt == 4)
{
float temp4= multi (a,b);
cout << "Your product is " << temp4 << endl;
}
else
{
cout << "That function is not supported in calculator!" << endl;
}
cout << "Thank you for using calculator" << endl;

return 0;
}

Thanks!

Mar 19, 2009 | Microsoft Computers & Internet

### HOW TO PROGRAM ARITHMETIC ALGORITHM( ADDITION)IN C++

above int main () you will want "using namespace std;" without quotes. Under that, "int main ()" without quotes, then a [ bracket to start the main function.

Mar 16, 2009 | Computers & Internet

### c++ programs

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier
Initializing arrays. When declaring a regular array of local scope (within a function, for example), if we do not specify otherwise, its elements will not be initialized to any value by default, so their content will be undetermined until we store some value in them. The elements of global and static arrays, on the other hand, are automatically initialized with their default values, which for all fundamental types this means they are filled with zeros
include <iostream>
using namespace std;

int billy [] = {16, 2, 77, 40, 12071};
int n, result=0;

int main ()
{
for ( n=0 ; n<5 ; n++ )
{
result += billy[n];
}
cout << result;
return 0;
}
multidimensional array pseudo-multidimensional array #define WIDTH 5 #define HEIGHT 3 int jimmy [HEIGHT][WIDTH]; int n,m; int main () { for (n=0;n<HEIGHT;n++) for (m=0;m<WIDTH;m++) { jimmy[n][m]=(n+1)*(m+1); } return 0; } #define WIDTH 5 #define HEIGHT 3 int jimmy [HEIGHT * WIDTH]; int n,m; int main () { for (n=0;n<HEIGHT;n++) for (m=0;m<WIDTH;m++) { jimmy[n*WIDTH+m]=(n+1)*(m+1); } return 0; }
and now for trignometry
#include<iostream>
#include<cmath>
using namespace std;

int main()
{
int factorial(int);
int n = 3, i = 1;
double x, x2, b, PI, r;
char choice;
//r = x * (PI / 180)

cout<<"Please enter an angle value => ";
cin>>x;
cout<<"Is the angle value in Degree or Radian?"<<endl;
cout<<"Type D if its in degree "<<endl;
cout<<"Type R if its in radian "<<endl;
cin>>choice;

if((choice = 'R')||(choice = 'r'))
do{
i++; n = 3; x2 = 0; b = x2;
{
if(i == 1)
x2 = x - (pow(x,n) /factorial(n));
n = n + 2;
};
else
{
x2 = (x2 + ((pow(x,n)) /(factorial(n))) - (pow(x,n+2)) / (factorial(n+2)));
n = n + 4;
}

}while(abs(b - x2) > 0.000001);
else
//convert it to r

r = x * PI /180;

//cout<<"error occured/n";
cout<<"sin(x) = "<<x2<<endl;

return 0;
}

Mar 24, 2008 | ArcMedia JavaScript Source Code 3000 Pro...

##### Not finding what you are looking for?

266 people viewed this tip

Level 3 Expert

Level 3 Expert