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
For important helping material related to the subject ( Solved MCQs, Assignments, Short Notes, Solved Past Papers, E-Books, Recommended Books, FAQs, Help & Tutorials , Short Questions Answers & more). You must view all the featured discussion in this subject group.
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
For important helping material related to the subject ( Solved MCQs, Assignments, Short Notes, Solved Past Papers, E-Books, Recommended Books, FAQs, Help & Tutorials , Short Questions Answers & more). You must view all the featured discussion in this subject group.
Please Discuss here about this assignment.Thanks
ReplyDeleteOur 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.
using function
ReplyDelete#include
#include
void Fahrenheit();
void Celsius();
void Kelvin();
main()
{
char chs;
char agn;
cout"***************************************\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
{
cout"\nPlease enter your option: ";
cin>>chs;
switch(chs)
{
case 'F':
case 'f':
Fahrenheit();
break;
case 'C':
case 'c':
Celsius();
break;
case 'K':
case 'k':
Kelvin();
break;
default:
cout"your choice is wrong !";
}
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;
}
Good Effort. Correct Solution.
DeleteProgram to convert Celsius to Kelvin
ReplyDelete#include
#include
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();
}
thnx asif bro.
Deletehow to attach these three codes by using loops??
ReplyDeleteis me switch statement use ho gi loop nai bhutta sahib
Delete