# www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Do not copy this, try yourself. this is only for idea purpose. i added this in pdf and word format both.

Views: 3392

Attachments:

### Replies to This Discussion

#include <iostream>
#include <conio.h>
using namespace std;

//www.virtualians.pk
main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;
cout " ********************** www.vustudents.ning.com*****************"endl;
cout " ********************** Tariq Malik***********************"endl;
cout " *********** Temprature Conversion Calculator **************";
cout "\n\n Please enter the temprature unit for which you want the coverison ";
cout "\n 1. F for Fahrenheit to Celcius and Kalvin";
cout "\n 2. C for Celsius to Fahrenheit and Kalvin";
cout "\n 3. K for Kalvin to Fahrenheit and Celcius";
startagain:
cout "\n\n Please enter you choice: ";
cin >> ch;
switch(ch)
{
case 'f':
case 'F':
cout " Please enter temprature in Farhenheit: ";
cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
cout " Celcius =" c_temp;
cout "\n Kelvin =" k_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'c':
case 'C':
cout " Please enter temprature in Celcius: ";
cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
cout " Kelvin =" k_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'k':
case 'K':
cout " Please enter temprature in Kelvin: ";
cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
cout " Celcius =" c_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calcute another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
default:
cout "\n Invalid Choice";
}
cout endlendl;
system("pause");
}

#include <iostream>

using namespace std;
int main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;
cout " ********************** Zahid Anwar ***********************"endl;
cout " *********** Temprature Conversion Calculator **************";
cout "\n\n Please enter the temprature unit for which you want the coverison ";
cout "\n 1. F for Fahrenheit to Celcius and Kalvin";
cout "\n 2. C for Celsius to Fahrenheit and Kalvin";
cout "\n 3. K for Kalvin to Fahrenheit and Celcius";
startagain:
cout "\n\n Please enter you choice: ";
cin >> ch;
switch(ch)
{
case 'f':
case 'F':
cout " Please enter temprature in Farhenheit: ";
cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
cout " Celcius =" c_temp;
cout "\n Kelvin =" k_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'c':
case 'C':
cout " Please enter temprature in Celcius: ";
cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
cout " Kelvin =" k_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'k':
case 'K':
cout " Please enter temprature in Kelvin: ";
cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
cout " Celcius =" c_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calcute another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
default:
cout "\n Invalid Choice";
}
cout endlendl;
return 0;

}

Cout k agay say (less than sign ) missing hay.. takreeban har statement mein..

cout " Kelvin =" k_temp;

iss trah ki statments mein inverted commas end pay ana hay na k pehlay.

Malik Tariq's ( Zahid Anwar) Solution

End wali line men endlendl dp dafa endl likha hay error ayga.

Dev-C++ software new version gives error in <iostream.h>

We have to use <iostream> instead of <iostream.h>

#include<conio.h>
#include<iostream>
using namespace std;

void function() //function for the menu
{
cout"enter the temperature unit for which you want the conversion ";
cout "\n 1. F for fahrenheit to celsius and kelvin";
cout"\n 2. C for celsius to fahrenheit and kelvin";
cout"\n 3. K for celsius and farenheit";
}
main()
{
char con;
char input;
do{ //do loop for repition
function();

cin>>input;
char con;

switch(input) //switch for different cases
{
case 'F':
case 'f':
cout"\nEnter temp in Fahrenheit";
float a1,b1,c1;
cin>>a1;
b1=(a1-32.0)/1.8;
cout"\ntemp in celsius is = "b1;
c1=(a1+459.67)*5/9;
cout"\ntemp in kelvin is = "c1;
break;
case 'C':
case 'c':
cout"\nEnter the temp in celsius ";
float a2,b2,c2;
cin>>a2;
b2=(a2*9/5)+32;
cout"\ntemp in F is = "b2;
c2=a2+273.15;
cout"\ntemp in kelvin is = "c2;
break;
case 'K':
case 'k':
cout"\nEnter the temp in kelvin ";
float a3,b3,c3;
cin>>a3;
b3=a3-273.15;
cout"\ntemp in celsius is = "b3;
c3=(a3-273.15)*1.8000+32.00;
cout"\ntemp in fahrenheit is = "c3;
break;
default:
cout"\nYou entered wrong option";
break;
}
cout"\ndo you want to continue(y/n)";
cin>>con;
if(con=='n'||con=='N')
return 0;
else
if(con=='y'||con=='Y')
main();

}while(1);
getche();
}

Complete and correct solution

//CS201 Introduction to Programming
// Assignment No. 01 Solution
// Fall 2013
//Virtual University
//Due Date: November 25, 2013
#include <iostream.h>
main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;

cout " *********** Temprature Conversion Calculator **************";
cout "\n\n Please enter the temprature unit for which you want the coverison ";
cout "\n 1. F for Fahrenheit to Celcius and Kalvin";
cout "\n 2. C for Celsius to Fahrenheit and Kalvin";
cout "\n 3. K for Kalvin to Fahrenheit and Celcius";
startagain:

cout "\n\n Please enter you choice: ";
cin >> ch;

switch(ch)

case 'f':
case 'F':
cout " Please enter temprature in Farhenheit: ";
cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
cout " Celcius =" c_temp;
cout "\n Kelvin =" k_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;

case 'c':
case 'C':
cout " Please enter temprature in Celcius: ";
cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
cout " Kelvin =" k_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;

case 'k':
case 'K':
cout " Please enter temprature in Kelvin: ";
cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
cout " Celcius =" c_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calcute another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;

default:
cout "\n Invalid Choice";
}
cout endlendl;
system("pause");
}

dear sobia u can download it from lms ..go to course website of cs 201..then from download section u can download it Dev C++ Version 4.9.9.2