We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

# www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

 Instructions: Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:   The assignment is submitted after due date. The submitted assignment does not open or file is corrupt. Assignment is copied(partial or full) from any source (websites, forums, students, etc)   Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files or .exe file, no reward will be given in any case.     Objective:   The objective of this assignment is to provide hands on experience of:   Basic concepts of C/C++ language and Programming Dealing with Data types Repetition Structures (Loops) Switch statement Saving a program Compiling a program Executing the program     Guidelines:   Code should be properly indented and well commented. Follow C/C++ rules while writing variable names, function names etc Use only dev-C++ for this assignment. Assignment Problem Statement:       You are required to write a simple “Temperature Conversion Calculator” using C++ language. The objective of this program should be to convert one temperature unit to other temperature units. These temperature units are Fahrenheit, Celsius and Kelvin etc.     Detailed Description:   The program should prompt the user to enter his/her option.   The program should respond in the following ways using switch statement:   If user enters option ‘F’ or ‘f’ then it should prompt the user to enter temperature in Fahrenheit. It should then convert it into Celsius and Kelvin and display the values on the screen. If user enters option ‘C’ or ‘c’ then it should prompt the user to enter temperature in Celsius. It should then convert it into Fahrenheit and Kelvin and display the values on the screen. If user enters option ‘K’ or ‘k’ then it should prompt the user to enter temperature in Kelvin. It should then convert it into Celsius and Fahrenheit and display the values on the screen.   After performing conversion operation, it should ask the user to continue or not. If user enters ‘n’ then it will quit the program otherwise it will perform the operation again   Sample output of program:               When user enters option C or c then it convert into Fahrenheit and Kelvin         When user enters option F or f then it convert into Celsius and Kelvin                             When user enters option K or k then it convert into Celsius and Fahrenheit         Hint:   Use the formulas given below for conversion. K = °C + 273.15 °F = °C × 9⁄5 + 32 K  = (°F + 459.67) × 5⁄9

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

Views: 1716

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

### Replies to This Discussion

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.

Attachments:

using function

#include<iostream.h>
#include<conio.h>

void Fahrenheit();
void Celsius();
void Kelvin();

main()
{
char chs;
char agn;
cout"******************<Temperature Conversion Calculator>*********************\n\n";
cout"Please enter the temperature unit for which you want the convetsion \n";
cout"1. F for Fahrenheit to Celsius and Kelvin\n";
cout"2. C for Celsius to Fahrenhit and Kelvin \n";
cout"3. K for Celsius and Fahrenheit \n";
do
{
cin>>chs;
switch(chs)
{
case 'F':
case 'f':
Fahrenheit();
break;
case 'C':
case 'c':
Celsius();
break;
case 'K':
case 'k':
Kelvin();
break;
default:
}
cout"\nDo you want to continue (y/n): ";
cin>>agn;
}
while(agn == 'Y' || agn == 'y');

system("pause");

}

void Fahrenheit()
{
float Celsius , Kelvin ,input;
cout"Enter temperature in Fahrenhetit: ";
cin>>input;
Celsius =(input - 32.0) / 1.8;
Kelvin = (input + 459.67) * 5/9;
cout"Celsius = " Celsius;
cout"\nKelvin = "Kelvin;
}

void Celsius()
{
float Fahrenheit ,Kelvin ,input;
cout"Enter temperature in Celsius: ";
cin>>input;
Kelvin = input + 273.15 ;
Fahrenheit = input * 1.8 + 32;
cout"Fahrenheti = "Fahrenheit;
cout"\nKelvin = "Kelvin ;
}

void Kelvin()
{
float Fahrenheit ,Celsius ,input;
cout"Enter temperature in Kelvin ";
cin>>input;
Fahrenheit = ( input - 273.15)* 1.8 + 32;
Celsius = input - 273.15;
cout"Celsius = " Celsius;
cout"\nFahrenheti = "Fahrenheit;
}

Attachments:

Program to convert Celsius to Kelvin

`#include<iostream.h>`
`#include<conio.h>`
`void` `main()`
`{`
`clrscr();`
`float` `a,b;`
`cout``"Enter the Temperature in Celsius"``endl;`
`cin>>a;`
`b=a+273;`
`cout``"Temperature in Kelvin is "``b;`
`getch();`
`}`

Program to convert Kelvin to Celsius

`#include<iostream.h>`
`#include<conio.h>`
`void` `main()`
`{`
`clrscr();`
`float` `a,b;`
`cout``"Enter the Temperature in Kelvin"``endl;`
`cin>>a;`
`b=a-273;`
`cout``"Temperature in Celcius is "``b;`
`getch();`
`}`

Program to convert Celsius to Fahrenheit

`#include<iostream.h>`
`#include<conio.h>`
`void` `main()`
`{`
`clrscr();`
`float` `a,b;`
`cout``"Enter the Temperature in Celsius"``endl;`
`cin>>a;`
`b=1.8*a+32.0;`
`cout``"Temperature in Fahrenheit is "``b;`
`getch();`
`}`

Program to convert Fahrenheit to Celsius

`#include<iostream.h>`
`#include<conio.h>`
`void` `main()`
`{`
`clrscr();`
`float a,b;`
`cout``"Enter the Temperature in Fahrenheit"``endl;`
`cin>>a;`
`b=(a-32.0)/1.8;`
`cout``"Temperature in Celsius is "``b;`
`getch();`
`}`

how to attach these three codes by using loops??

is me switch statement use ho gi loop nai bhutta sahib

CS201 Introduction to Programming Assignment Solution Fall 2013

Due Date:  25-11-2013

Solved By:    Lion

#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");

}

To learn programming watch others listen others and practice yourself. Remember these golden words.

“I hear I forget, I do I learn”    Unknown.

# cs201 first assignment complete solution due date 25-11-13

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

Views: 36

Attachments:

Its idea try to correct it

#include<conio.h>
#include<iostream.h>
void function() //function for the menu
{
clrscr();//to clear the screen
cout"Please 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";
}
void main()
{
char con;
do{//do loop for repition
function();
char input;
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;
}while(con=='y'|| con=='Y');//for repeating
function();
if(con=='n'||con=='N')//for ending the program
getch();
}

#include<conio.h>
#include<iostream.h>
void function() //function for the menu
{
clrscr();//to clear the screen
cout"Please 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";
}
void main()
{
char con;
do{//do loop for repition
function();
char input;
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;
}while(con=='y'|| con=='Y');//for repeating
function();
if(con=='n'||con=='N')//for ending the program
cout"Allah hafiz";
getch();
}

## Latest Activity Waseem Aziz added a discussion to the group MGMT627 Project Management
1 hour ago Waseem Aziz added a discussion to the group STA630 Research Methods
1 hour ago Waseem Aziz joined + M.Tariq Malik's group
1 hour ago Zain Arshad, Misha Rajpoot and Nimra zahid joined + M.Tariq Malik's group
1 hour ago